文章作者 100test 发表时间 2007:09:06 11:53:40
来源 100Test.Com百考试题网
public class LogingAspect { public void logMethod(JoinPoint jp){ System.err.println(jp.getTarget().getClass()). System.err.println(jp.getSignature().getName()). } } |
< bean id = " logAspectTarget " class = " hibernatesample.service.util.LogingAspect " > </ bean > < aop:config > < aop:aspect id = " logAspect " ref = " logAspectTarget " > < aop:pointcut id = " businessService " expression = " execution(* hibernatesample.service.*.*(..)) " /> < aop:after pointcut - ref = " businessService " method = " logMethod " /> </ aop:aspect > </ aop:config > |
< tx:advice id = " txAdvice " transaction - manager = " transactionManager " > < tx:attributes > < tx:method name = " get* " read - only = " true " /> < tx:method name = " find* " read - only = " true " /> < tx:method name = " * " /> </ tx:attributes > </ tx:advice > < aop:config > < aop:pointcut id = " demoServiceMethods " expression = " execution(* hibernatesample.service.*.*(..)) " /> < aop:advisor advice - ref = " txAdvice " pointcut - ref = " demoServiceMethods " /> < aop:aspect id = " logAspect " ref = " logAspectTarget " > < aop:pointcut id = " businessService " expression = " execution(* hibernatesample.service.*.*(..)) " /> < aop:after pointcut - ref = " businessService " method = " logMethod " /> </ aop:aspect > </ aop:config > |
相关文章
Java小技巧:关于Cookie的操作
ApacheCXF2.0发布并通过JAX-WS2.0TCK
对Java程序多态性支持的改进
关于Ecli e3.0的插件自动构建简介
ring2.X中AOP的使用浅析
Java程序员需要了解的几个开源协议
Ecli e插件开发中实现刷新和重编译
Java实战篇:设计自己的A otation
Java中调用SQLServer存储过程示例
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛