Moving mvc interceptor from module-context to web-

2019-09-01 16:14发布

问题:

Can we move mvc interceptors from individual context file to web-application context.xml Thus removing interceptor from individual module context?

回答1:

You can put them in the web-context as follow:

<mvc:interceptors>
    <bean class="com.package.TheInterceptor" />
    <bean class="com.package.AnotherInterceptor" />
</mvc:interceptors>