读书人

lt;aop:pointcut expression=quot;execution

发布时间: 2013-03-12 11:19:35 作者: rapoo

<aop:pointcut expression="execution(* com.tfy.aop.exception.ClassesServiceImpl.*(..))" id="perform"
<?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>

读书人网 >云计算

热点推荐