Update: As with Spring Framework 5.0.1 (and SPR-16034 ), interceptors are automatically displayed on the ResourceHttpRequestHandler by default.
I think that the configured interceptors are not displayed on the resource handler, but on a single @RequestMapping .
Maybe try this instead?
@EnableWebMvc //equivalent to mvc:annotation-driven @Configuration @PropertySource("classpath:configuration.properties") public class WebConfig extends WebMvcConfigurerAdapter { @Inject private TimingInterceptor timingInterceptor; @Inject private CORSHeaders corsHeaders; // equivalent to mvc:resources @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Bean public MappedInterceptor timingInterceptor() { return new MappedInterceptor(new String[] { "/**" }, timingInterceptor); } @Bean public MappedInterceptor corsHeaders() { return new MappedInterceptor(new String[] { "/**" }, corsHeaders); } }
This should be better documented with SPR-10655 .
source share