
一、创建日志注解
1、 日志类型枚举类
2、自定义日志注解
二、利用AOP实现日志切面统一处理
1、 日志实现类创建工厂
2、 切面类
三、 创建日志实现类
1、添加日志接口
2、添加日志接口实现类
四、controller
spring 配置aop去拦截你的action中的方法,执行日志记录<aop:config>
<aop:pointcut id="logPointcutVac"
expression="execution(* 写你需要拦截的地址以及方法名,可以用通配符)" />
<aop:pointcut id="logPointcutVacCp"
expression="execution(* 写你需要拦截的地址以及方法名,可以用通配符)" />
<aop:pointcut id="logPointcutCrm"
expression="execution(* 写你需要拦截的地址以及方法名,可以用通配符)" />
<aop:aspect id="logging" ref="logAroundAdvice">
<aop:around pointcut-ref="logPointcutVac" method="invoke" />
<aop:around pointcut-ref="logPointcutVacCp" method="invoke"/>
<aop:around pointcut-ref="logPointcutCrm" method="invoke" />
</aop:aspect>
</aop:config>
具体这里有 http://hi.baidu.com/ryan_dream/blog/item/59154e50e5d049541138c2f2.html
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)