AOP 面向方面编程(面向切面)

来源:互联网 发布:linux lb 集群 编辑:程序博客网 时间:2024/05/20 01:46
  
                                        在AOP中,5中装备类型:
*Before装备:在执行目标操作之前执行的装备.
接口:org.springframework.aop.MethodBeforeAdvice
*Throws装备:若目标操作在执行过程中抛出了异常,则该装备会执行.(推荐用Java捕获异常即可).
接口:org.springframework.aop.ThrowsAdvice
*After装备:在执行目标操作之后执行的装备.
接口:org.springframework.aop.AfterReturningAdvice
*Around装备:在方法调用前后执行的装备.(功能强大).
接口:org.aopalliance.intercept.MethodInterceptor
*Introduction装备:由于Introduction装备能够为类新增方法,因此在所有5种装备中,它最复杂,也难掌握.
原创粉丝点击