[bs-153] Don't expose classes as resource

Made classpath:/[static,resourecs,public] available instead. Some
sample apps had to change so probably some gs-* guides etc as well?

[Fixes #51368907]
This commit is contained in:
Dave Syer
2013-07-16 15:30:26 +01:00
parent 6c3fd2b2d0
commit f0d5b8bbe3
6 changed files with 7 additions and 11 deletions

View File

@@ -121,16 +121,12 @@ public class WebMvcAutoConfiguration {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// FIXME exposing the root classpath is a security risk
// eg http://localhost:8080/org/springframework/bootstrap/Banner.class
registry.addResourceHandler("/resources/**").addResourceLocations("/")
.addResourceLocations("classpath:/META-INF/resources/")
.addResourceLocations("classpath:/resources/")
.addResourceLocations("classpath:/");
registry.addResourceHandler("/**").addResourceLocations("/")
.addResourceLocations("classpath:/META-INF/resources/")
.addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/");
registry.addResourceHandler("/resources/**").addResourceLocations("/",
"classpath:/META-INF/resources/", "classpath:/resources/",
"classpath:/public/", "classpath:/static/");
registry.addResourceHandler("/**").addResourceLocations("/",
"classpath:/META-INF/resources/", "classpath:/resources/",
"classpath:/static/", "classpath:/public/");
}
@Configuration