Announcement Announcement Module
No announcement yet.
applying aspectj to OpenSessionInViewFilter Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • applying aspectj to OpenSessionInViewFilter


    I have a tracing (around) aspect that would time the execution time of the methods. I'd like to apply that to OpenSessionInViewFilter class. However my aop.xml is being read after the classloading of the above class. I was wondering if there was a trick to apply this tracing aspect to classes outside my webapp. Is that possible? I must also mention that I'm doing LTW with aspectj.

    Thanks for the help,
    Last edited by ramin; Nov 11th, 2010, 05:42 PM. Reason: added clarification

  • #2
    Non-spring managed classes can be dependency injected with the help of aspectj and the spring annotation @Configurable.
    But such classes have to be available to byte-code instrumentation.

    I think, it should be possible to further enrich such classes, annotated with @Configurable, with aspects.


    • #3
      The question is: how can I apply AOP (aspectJ) to the classes that are not part of my webapp but do belong to the container (tomcat in this case).


      • #4
        not possible

        then it is not possible


        • #5
          Well it is possible but you would have to switch to loadtime weaving with the full blown aspectj solution instead of proxy based aop..


          • #6
            Well, I am already doing that. LTW with true aspectJ AOP. The question is how do i expose classes that are not part of my webapp (basically the container classes) to aspectJ? And how do I tell aspectJ to weave those classes.


            • #7
              Yyou are using loadtime weaving in your application NOT the whole container.. You should enable/configure it for the whole container (I suggest a read of the aspectj reference guide on how to do that, it requires a java-agent.).