October 2018
Intermediate to advanced
982 pages
23h 29m
English
Despite what you might think, after seeing the previous recipe, adding an interceptor is not as straightforward as just declaring it as a bean. We actually need to do it via WebMvcConfigurer or by overriding WebMvcConfigurationSupport. Let's take a look at the following steps:
public class WebConfiguration implements WebMvcConfigurer {...}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
return new LocaleChangeInterceptor();
}
Read now
Unlock full access