<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="classesDao" class="com.tfy.aop.exception.ClassesDaoImpl">
</bean>
<bean id="classesService" class="com.tfy.aop.exception.ClassesServiceImpl">
<property name="classesDao">
<ref bean="classesDao"/>
</property>
</bean>
<bean id="classesAction" class="com.tfy.aop.exception.ClassesAction">
<property name="classesService">
<ref bean="classesService"/>
</property>
</bean>
<bean id="myException" class="com.tfy.aop.exception.MyException"></bean>
<!--
切入点表达式的作用就是找到目标类
-->
<aop:config>
<aop:pointcut expression="execution(* com.tfy.aop.exception.ClassesServiceImpl.*(..))" id="perform"/>
<aop:aspect ref="myException">
<aop:after-throwing method="myException" pointcut-ref="perform" throwing="ex"/>
</aop:aspect>
</aop:config>
</beans>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<bean id="classesDao" class="com.tfy.aop.exception.ClassesDaoImpl">
</bean>
<bean id="classesService" class="com.tfy.aop.exception.ClassesServiceImpl">
<property name="classesDao">
<ref bean="classesDao"/>
</property>
</bean>
<bean id="classesAction" class="com.tfy.aop.exception.ClassesAction">
<property name="classesService">
<ref bean="classesService"/>
</property>
</bean>
<bean id="myException" class="com.tfy.aop.exception.MyException"></bean>
<!--
切入点表达式的作用就是找到目标类
-->
<aop:config>
<aop:pointcut expression="execution(* com.tfy.aop.exception.ClassesServiceImpl.*(..))" id="perform"/>
<aop:aspect ref="myException">
<aop:after-throwing method="myException" pointcut-ref="perform" throwing="ex"/>
</aop:aspect>
</aop:config>
</beans>
作者:tfy1332 发表于2013-3-8 0:06:00 原文链接
阅读:106 评论:0 查看评论