java - Dispatcher servlet and ResourceHttpRequestHandler conflict -


After

the webapp needs to serve static content and the process calls on the other way. In the config I have registered the ResourceHttpRequestHandler and the Dispatcher Servlet.

  @Override Public Zero addResourceHandlers {ResourceHandlerRegistry registry} {registry.addResourceHandler ("/ index.html") addResourceLocations ("index.html"); } @Bean Public ServletRegistrationBean dispatcherRegistration (DispatcherServlet dispatcherServlet) {ServletRegistrationBean Registration = New ServletRegistrationBean (dispatcherServlet); Registration.setLoadOnStartup (1); Registration.addUrlMappings ("/ left / *"); Return registration; } @Bean (name = "dispatcherServlet") Public DispatcherServlet dispatcherServlet (WebApplicationContext Reference) {New DispatcherServlet (reference) Return; }  

But the problem is that if I remove the service of the Dispatcher Servlet Resource works, then the Dispatcher Servlet has been registered that the reource handler is not applicable.

How to get rid of this problem?

Maybe I should also serve the static material with the Dispatcher Servlet?


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Chart control: Design messed Up after clearing and re-adding Y-Values -

javascript - Bootstrap Modal won't close, previously appended to Body using JQuery -