springmvc 配置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:aop="http://www.springframework.org/schema/aop"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

   <bean id="advice" class="com.hhwy.fm.office.schedule.AroundAdvice"/>
   <bean id="cut" class="org.springframework.aop.aspectj.AspectJExpressionPointcut">
      <property name="expression" value="execution(* com.hhwy.bpm.runtime.service..*.*(..))"></property>
   </bean>
   <bean id="advisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
      <property name="advice" ref="advice"/>
      <property name="pointcut" ref="cut"></property>
   </bean>
   <aop:aspectj-autoproxy/>
</beans>

二:express

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    ">

   <context:annotation-config />
   <context:component-scan base-package="com.enjoy" />

   <!-- 插件工廠配置 -->
   <bean id="pluginFactory" class="com.enjoy.spring.DefaultSpringPluginFactory" />
   <aop:config>
      <aop:aspect id="aspect" ref="pluginFactory">
         <aop:pointcut id="point" expression="execution(* *.*(..))" />
         <aop:before method="doBefore" pointcut-ref="point" />
      </aop:aspect>
   </aop:config>
</beans>
相關文章
相關標籤/搜索