Spring通知

Interception Around通知 MethodInterceptor类(方法执行前后通知)

Before通知 MethodBeforeAdvice类(方法执行前通知)

After Returning通知 AfterReturningAdvice类(方法执行后通知)

Throw通知 ThrowsAdvice类(方法执行抛出异常时通知)

Introduction通知 IntroductionAdvisor类和IntroductionInterceptor类(方法执行完通知)

具体事例:

LogAround implements MethodInterceptor

TimeBook implements TimeBookInterface

配置文档   Interception Around通知

 1 <!--以下是使用Spring AOP实现日志-->
 2 <bean id="log" class="com.gc.antion.LogAround"/>
 3 <bean id="timeBook" class="com.gc.action.TimeBook"/>
 4 <bean id="logProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
 5   <property name="proxyInterfaces">
 6     <value>com.gc.impl.TimeBookInterface</value>
 7   </property>
 8   <!--指定要代理的类-->
 9   <property name="interceptorNames">
10     <list>
11       <value>log</value>
12     <list>
13   </property>
14 </bean>
View Code

相关文章:

  • 2021-09-20
  • 2021-12-13
  • 2022-12-23
  • 2021-08-28
  • 2021-09-19
  • 2021-10-20
  • 2022-12-23
  • 2021-06-27
猜你喜欢
  • 2021-07-17
  • 2021-04-05
  • 2022-12-23
  • 2021-09-17
  • 2021-08-13
  • 2021-07-12
相关资源
相似解决方案