4 Replies Latest reply on Jul 28, 2008 10:30 AM by Pete Muir

    Seam Interceptors vs. AspectJ

    John Skillings Newbie

      I would like to integrate a license management feature within my
      Seam application, using the steps outlined at the following URL.


      Intially, I thought this would be a very straight forward implementation, but the more I look into, the issue seems to be Seam's minimal support for AOP and AspectJ.

      Can any one let me know if Seam Interceptors are the only way to go to achieve the necessary functionality here or is there better alternative?

      Thank you.


        • 1. Re: Seam Interceptors vs. AspectJ
          Jacob Orshalick Apprentice

          I have used AspectJ with Spring applications but never with a Seam application as I have always been able to achieve what I needed through interceptors.  You could always give AspectJ a shot with the ajc compiler and report back your results ;)

          Perhaps I do not fully understand your requirements, but interceptors seem like a reasonable approach for your scenario.  Why not simply define an annotation to tag the concerned classes and define a stereotype for the classes?  Say,

          public class MyLicensedClass {
            ... ...

          It's then quite simple to define an interceptor:

          public @interface LicenseRestricted {}

          Hope that helps.

          • 2. Re: Seam Interceptors vs. AspectJ
            Pete Muir Master

            I don't see how Seam limits you in using AOP?

            • 3. Re: Seam Interceptors vs. AspectJ
              John Skillings Newbie

              Agreed.  Seam provides AOP support using Interceptors.   My questions was more on integrating AspectJ, and I have not seen any concrete examples of AspectJ integration. Hence my inquiry in the first place.

              • 4. Re: Seam Interceptors vs. AspectJ
                Pete Muir Master

                Your Seam components and JPA entities are POJOs so you should be able to use any AOP library to do bytecode enhancement. For example, with JBoss AS, look at JBoss AOP as it is built in.

                No, there is no special integration, there doesn't need to be.