I\'m trying to register an instance of HandlerInterceptor in Spring using Java Config without extending WebMvcConfigurationSupport. I\'m c
Edit: This class has since been deprecated. See @bosco answer below for the Spring 5 equivalent.
Figured it out, the solution is to use, simply:
@Configuration
public class AnnotationSecurityConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new SecurityAnnotationHandlerInterceptor());
}
}
In spring boot, all beans of type WebMvcConfigurer are automatically detected and can modify the MVC context.