Akshay Bande
Akshay Bande

Reputation: 2587

How to specify order of spring handler interceptors in xml configuration file?

I want to use two handler interceptors in my spring project. First interceptor to authenticate token. Second interceptor to store authenticated token in spring context. I am using xml interceptor configuration. How to specify order for handler interceptors.

<mvc:interceptors>
    <mvc:interceptor>
        <mvc:mapping path="/**" />
        <bean class="com.megapath.interceptor.TokenValidatorInterceptor">               
        </bean>
    </mvc:interceptor>
    <mvc:interceptor>
        <mvc:mapping path="/**" />
        <bean class="com.megapath.interceptor.TokenStoreInterceptor">               
        </bean>
    </mvc:interceptor>
</mvc:interceptors>

Upvotes: 4

Views: 1667

Answers (1)

Akshay Bande
Akshay Bande

Reputation: 2587

Thanks to M. Deinum. The order in which you define interceptors is the order they get executed.

Upvotes: 1

Related Questions