Spring 配置文件AOP

 1 <!-- 配置切面bean -->
 2         <bean id="permAspect" class="com.tx.spring.aspect.PermAspect"></bean>
 3         
 4         <bean id="userService" class="com.tx.spring.service.impl.UserServiceImpl"></bean>
 5         
 6         <aop:config>
 7             <!-- 配置切点 -->
 8             <aop:pointcut expression="execution(* com.tx.spring.service..*.*(..))" id="mycut"/>
 9             <!-- 配置切面 -->
10             <aop:aspect ref="permAspect">
11                 <aop:before method="preAspect" pointcut-ref="mycut"/>
12                 <aop:after method="afterAspect" pointcut-ref="mycut"/>
13                 <!-- 返回通知 -->
14                 <aop:after-returning method="returnAdvice" pointcut-ref="mycut" returning="returnval"/>
15                 <!-- 环绕通知 -->
16                 <aop:around method="aroundAdvice" pointcut-ref="mycut" />
17             </aop:aspect>
18         </aop:config>

 

posted @ 2018-04-03 08:45  cat_fish  阅读(93)  评论(0编辑  收藏  举报