开发者

java audit log every method using aspectj

开发者 https://www.devze.com 2023-02-08 06:29 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消