有没有简单的配置例子啊。在spring配置文件中配置了切片 然后需要在dao或者service中些记录日志的代码不?

解决方案 »

  1.   

    <!-- 第一个* 表示 返回任意的类型 -->
    <!-- service.. 代表service包及其子包-->
    <!-- 第二个* 表示 该包下的所有类 -->
    <!-- 第三个* 表示 类下的所有方法 -->
    <!-- ( .. ) 表示 方法带任意参数 -->
      
    <aop:config>
    <aop:advisor
    pointcut="execution(* *..service*..*(..))"
    advice-ref="txAdvice" />
    </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager">
    <tx:attributes>
    <tx:method name="get*" read-only="true" />
    <tx:method name="*" rollback-for="Exception" />
    </tx:attributes>
    </tx:advice>