在Spring中有条件地应用拦截器

时间:2011-01-28 22:01:43

标签: java spring java-ee

如何在条件下添加myOtherInterceptor?

<bean id="myService" class="org.springframework.aop.framework.ProxyFactoryBean">
   <property name="proxyInterfaces"><value>IMyService</value></property>
   <property name="target">
      <bean parent="baseServiceTarget" class="MyService" />
   </property>
   <property name="interceptorNames">
      <list>
         <value>myInterceptor</value>
         <value>myOtherInterceptor</value>
      </list>
   </property>
</bean>

1 个答案:

答案 0 :(得分:6)

您可以在拦截器中拥有该条件。