主要适用于写日志等操作,可以在dao层 业务层添加,但是必须是借口才能使用
配置方法
<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.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean id="log" class="com.hw.util.Log"/>
<aop:config>
<aop:pointcut expression="execution(* com.hw.service.IUser.add*(..))" id="add"/>
<aop:aspect ref="log">
<aop:after method="Write" pointcut-ref="add"/>
</aop:aspect>
</aop:config>
</beans>