拦截器

您可以注册拦截器以应用于传入的请求,如下例所示:

@Configuration
public class WebConfiguration implements WebMvcConfigurer {

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new LocaleChangeInterceptor());
    // registry.addInterceptor(new ThemeChangeInterceptor())
    //   .addPathPatterns("/**").excludePathPatterns("/admin/**");
  }
}