Nov 11th, 2010, 03:35 PM
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 at 05:42 PM.
Reason: added clarification
Nov 25th, 2010, 01:48 PM
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.
Nov 26th, 2010, 03:12 PM
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).
Dec 4th, 2010, 01:38 AM
Dec 4th, 2010, 05:17 AM
Well it is possible but you would have to switch to loadtime weaving with the full blown aspectj solution instead of proxy based aop..
Dec 4th, 2010, 08:03 AM
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.
Dec 5th, 2010, 03:46 AM
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.).