AOP切面编程(必须实现统一接口),spring中的配置示例

 <?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:context="http://www.springframework.org/schema/context"

             xmlns:aop="http://www.springframework.org/schema/aop"

             xmlns:tx="http://www.springframework.org/schema/tx"

             xsi:schemaLocation="http://www.springframework.org/schema/beans

                     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

                     http://www.springframework.org/schema/context

                     http://www.springframework.org/schema/context/spring-context-3.0.xsd

                     http://www.springframework.org/schema/aop

                     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd

                     http://www.springframework.org/schema/mvc

                     http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd

                     http://www.springframework.org/schema/tx

                     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

      <!-- 配置AOP -->

      <aop:config>

      <aop:aspect id="door" ref="door">

     <aop:pointcut expression="execution(* com.Solder.pass*(..))" id="caixen"/>

      <aop:after-returning method="addBlood" pointcut-ref="caixen"/>

      </aop:aspect>

      </aop:config>

       

       <!-- 设置注解方式管理bean -->

       <context:annotation-config></context:annotation-config>

       <context:component-scan base-package="com"></context:component-scan>

</beans>

猜你喜欢

转载自myokm123.iteye.com/blog/1837269