Add exclude patterns for mapped interceptors
Add the ability provide exclude patterns for mapped interceptors in the MVC namespace and in the MVC Java config. Issue: SPR-6570
This commit is contained in:
@@ -4453,7 +4453,8 @@ public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(new LocalInterceptor());
|
||||
registry.addInterceptor(new LocaleInterceptor());
|
||||
registry.addInterceptor(new ThemeInterceptor()).addPathPatterns("/**").excludePathPatterns("/admin/**");
|
||||
registry.addInterceptor(new SecurityInterceptor()).addPathPatterns("/secure/*");
|
||||
}
|
||||
|
||||
@@ -4463,6 +4464,11 @@ public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
<programlisting language="xml"><mvc:interceptors>
|
||||
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
|
||||
<mvc:interceptor>
|
||||
<mapping path="/**"/>
|
||||
<exclude-mapping path="/admin/**"/>
|
||||
<bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
|
||||
</mvc:interceptor>
|
||||
<mvc:interceptor>
|
||||
<mapping path="/secure/*"/>
|
||||
<bean class="org.example.SecurityInterceptor" />
|
||||
|
||||
Reference in New Issue
Block a user