Answer the question
In order to leave comments, you need to log in
How to configure the return of statics from the root of the site in spring mvc?
hello
web.xml
<servlet>
<servlet-name>spring-web</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>spring-web</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
//registry.addResourceHandler("/builds/**") .addResourceLocations("/builds/").setCachePeriod(3600);
registry.addResourceHandler("/**").addResourceLocations("/favicon.ico"); // Не работает!
}
Answer the question
In order to leave comments, you need to log in
Look at the code of the class from which you are inheriting what the addResourceHandlers method does or how the spring classes implement this method. By default, there are already added paths there, put your files there.
The problem was in the controller that intercepted requests
@RequestMapping(value = {
"/{login:(?iu)[a-z_0-9]{5,64}}",
"/{login:(?iu)[a-z_0-9]{5,64}}/{modifier:draft}"
}, method = RequestMethod.GET)
[[^.]a-z_0-9]
to separate files from user pages.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question