I have an application which uses quite an old version of spring boot. I have applied interceptor in the application but request is not coming to the interceptor.
@Configuration
public class TestConfiguration extends WebMvcConfigurerAdapter {
@Bean
public GenericInterceptor genericInterceptor() {
return new GenericInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(genericInterceptor()).addPathPatterns("/**");
}}
The bean returned class is GenericInterceptor declared below.
public class GenericInterceptor extends HandlerInterceptorAdapter{
// custom logic
}
The main spring boot class is defined below
@SpringBootApplication
@EnableWebMvc
public class TestApplication implements WebApplicationInitializer {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}}
Request is not coming to the Generic Interceptor. Is this because of @EnableWebMvc or something is missing. Can someone explain ?