Reputation: 297
Can I use the following configuration simultaneously?
<mvc:resources mapping="/static/**" location="/static/, classpath:/static/"/>
and
@Configuration
@EnableWebMvc
public class ResourceMappingsAdapter extends WebMvcConfigurerAdapter {
...
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/anotherStatic/", "file:///...");
}
The mapping added from the WebMvcConfigurerAdapter doesn't seem to serve the content.
Upvotes: 1
Views: 643
Reputation: 297
After all I figured this out. The order seems to matter. Adjusting the
<mvc:resources mapping="/static/**" location="/static/" order="1"/>
and
registry.setOrder(Ordered.HIGHEST_PRECEDENCE)
in the WebMvcConfigurerAdapter solved the issue.
Upvotes: 2