配置文件 mark一下 

<?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.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd"
>
<bean id="person" class="com.fpy.pojo.Person1"></bean>
<bean id="advice" class="com.fpy.advice.MyAdvice"></bean>
<aop:config>
<aop:aspect ref="advice">
<aop:pointcut expression="execution(* com.fpy.pojo.Person1.show(String)) and args(name)" id="pc"></aop:pointcut>
<aop:before method="before" arg-names="name" pointcut-ref="pc"></aop:before>
</aop:aspect>
</aop:config>
</beans>
<?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.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<!-- 配置Dao对象 -->
<bean id="demoDao" class="com.fpy.dao.impl.DemoDaoImpl"></bean>

<!-- 配置Service对象 -->
<bean id="demoService" class="com.fpy.service.impl.DemoServiceImpl">
<property name="demoDao" ref="demoDao" />
</bean>

<!-- 配置通知对象 -->
<bean id="before" class="com.fpy.advice.TxOpenAdvice"></bean>
<bean id="after" class="com.fpy.advice.TxCommitAdvice"></bean>
<bean id="exception" class="com.fpy.advice.TxRollbackAdvice"></bean>
<bean id="logger" class="com.fpy.advice.LoggerAdvice"></bean>

<!-- AspectJ方式配置织入 -->
<aop:config>
<!-- 配置切点 -->
<!--
id: 切点的唯一标识
expression: 切点表达式, 用于定位切点方法
execution: 固定写法, 表示执行方法
*: 表示返回值类型为任意类型
com.fpy.service: 表示包
*.*: 任何类(接口)下的任何方法名
(..): 任何类型的任意个参数
-->
<aop:pointcut expression="execution(* com.fpy.service.*.*(..))" id="pc" />
<!-- 配置通知 -->
<aop:advisor advice-ref="before" pointcut-ref="pc" />
<aop:advisor advice-ref="after" pointcut-ref="pc" />
<aop:advisor advice-ref="exception" pointcut-ref="pc" />
<aop:advisor advice-ref="logger" pointcut-ref="pc" />
</aop:config>
</beans>