I am using Spring boot 1.3.3
My application resources exist under src/main/resources/static
example: src/main/resources/static/index.html
I am trying to map my static resources with a prefix like
/*/resource/**
So that it matches urls like
/main/resource/** AND
/app/resource/**
When I try that using following code
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
"classpath:/META-INF/resources/", "classpath:/resources/",
"classpath:/static/", "classpath:/public/" };
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/*/resource/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
It comes up with a 404 when I request for domain:8080/app/resource/index.html
But returns requested page when I do domain:8080/index.html (It looked like some default matchers are overriding the ones that I tried to configured.)
And when I use the following code
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/app/resource/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
}
It returns the page domain:8080/app/resource/index.html as expected.
Is something wrong with the ant matchers I am using above? Can I use static resources in the way I want?
Any help is appreciated ..