Disable springboot request checking when clicking html link [closed]

Tags: , , ,



I am using springboot with html pages. When i click a link (which is just a redirect a href) to navigate to next page the springboot shows whitelabel error page. Springboot check for the requestmapping when i clicking a a href. I want to disable this. when i click a link i dont want the springboot to check for the request mapping.

Answer

Path Matching and Content Negotiation

Spring MVC can map incoming HTTP requests to handlers by looking at
the request path and matching it to the mappings defined in your
application (for example, @GetMapping annotations on Controller
methods).

By default, Spring Boot serves static content from a directory called
/static (or /public or /resources or /META-INF/resources) in the
classpath or from the root of the ServletContext. It uses the
ResourceHttpRequestHandler from Spring MVC so that you can modify that
behavior by adding your own WebMvcConfigurer and overriding the
addResourceHandlers method.

In a stand-alone web application, the default servlet from the
container is also enabled and acts as a fallback, serving content from
the root of the ServletContext if Spring decides not to handle it.
Most of the time, this does not happen (unless you modify the default
MVC configuration), because Spring can always handle requests through
the DispatcherServlet.

You have to define the behavior of fallback method.



Source: stackoverflow