@ -19,6 +19,7 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfiginterceptors;
@@ -19,6 +19,7 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfiginterceptors;
import org.springframework.context.annotation.Configuration ;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry ;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer ;
import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor ;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor ;
// tag::snippet[]
@ -28,6 +29,7 @@ public class WebConfiguration implements WebMvcConfigurer {
@@ -28,6 +29,7 @@ public class WebConfiguration implements WebMvcConfigurer {
@Override
public void addInterceptors ( InterceptorRegistry registry ) {
registry . addInterceptor ( new LocaleChangeInterceptor ( ) ) ;
registry . addInterceptor ( new UserRoleAuthorizationInterceptor ( ) ) . addPathPatterns ( "/**" ) . excludePathPatterns ( "/admin/**" ) ;
}
}
// end::snippet[]