记录一个有意思的spring aop配置
2020-03-08 12:38
162 查看
<!-- 配置 Service 层日志记录 --> <bean id="serviceLogging" class="com.ken.wms.util.aop.ServiceLogging"/> <!-- 配置用户操作日志记录 --> <bean id="userOperationLogging" class="com.ken.wms.util.aop.UserOperationLogging"/> <!-- AOP 配置 --> <aop:config> <aop:pointcut id="serviceMethodLoggingPointcut" expression="execution(* com.ken.wms.common.service.Impl.*.*(..)) || execution(* com.ken.wms.security.service.Impl.*.*(..))"/> <aop:aspect id="serviceLoggingAspect" ref="serviceLogging" order="100"> <aop:before method="loggingMethodInvoked" pointcut-ref="serviceMethodLoggingPointcut"/> <aop:after-throwing method="loggingServiceException" pointcut-ref="serviceMethodLoggingPointcut" throwing="throwable"/> </aop:aspect> </aop:config> <aop:config> <aop:pointcut expression="execution(* com.ken.wms.common.service.Impl.*.*(..)) and @annotation(userOperation)" id="userOperationLoggingPointcut"/> <aop:aspect id="userOperationLoggingAspect" ref="userOperationLogging" order="20"> <aop:after-returning method="loggingUserOperation" pointcut-ref="userOperationLoggingPointcut" returning="returnValue"/> </aop:aspect> </aop:config>
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 记录一个有意思的spring mvc 配置
- 一个spring 基本知识的微博(怎么加载多个xml、多个property文件、aop配置、监视器)
- 一个关于Spring AOP很有意思的问题。
- Spring在配置Shiro 关于AOP的部分记录
- 利用Spring的AOP来配置和管理你的二级缓存(EHCache) 记录以备查询
- SpringBoot2.0 基础案例(11):配置AOP切面编程,解决日志记录业务
- Spring学习记录(十三)---基于xml文件配置AOP
- 一个用Spring AOP实现异常处理和记录程序执行时间的实例(一)
- 一个用Spring AOP实现异常处理和记录程序执行时间的实例(二)
- 基于Spring AOP和Groovy日志模板配置的日志记录框架的二次实现与使用案例
- Spring AOP面向切面编程一个简单例子和在配置过程中出现错误
- SpringBoot (四) 配置 AOP 记录日志
- Spring使用AOP记录日志(javaconfig配置)
- 记录一个常用的Spring项目框架,零XML配置,尽量少编写SQL。
- spring aop 面向切面编程 如何来做一个强大的日志记录功能
- 一个用Spring AOP实现异常处理和记录程序执行时间的实例--邵京国
- SpringBoot 中的aop配置,完成日志记录功能
- 5.11 一个用Spring AOP实现异常处理和记录程序执行时间的实例
- 基于配置的spring AOP的一个示例
- 使用AOP进行日志记录的Spring Boot数据库项目配置