hymnotes
hymnotes

Reputation: 11

Conditionally Apply an Interceptor in Spring

How can I conditionally add myOtherInterceptor below?

<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>

Upvotes: 1

Views: 1963

Answers (1)

Bozho
Bozho

Reputation: 597016

You can have the condition within the interceptor.

Upvotes: 7

Related Questions