Annotation Configuration Replacement for mvc:resources – Spring

For Spring 3 & 4:

One way to do this is to have your configuration class extend WebMvcConfigurerAdapter, then override the following method as such:

@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
}

Leave a Comment