java audit log every method using aspectj
How to log messages for every method before and after the method executes. Mainly for all classes in a package whether they are managed by spring or not. Using spring aop you can intercept beans that are managed by spring, but how to intercept beans that are not managed. I don't want to use java -agent option, as it requires a jar in tomcat and other开发者_StackOverflow社区 few things to be done to get it working. is compile time weaving the only choice?
You can add the aspect at time of compilation.
Or you can use load time weaving, either by using the java -agent property or by using Spring LTW:
http://static.springsource.org/spring/docs/3.0.0.RC1/spring-framework-reference/html/ch07s08.html#aop-aj-ltw
精彩评论