Tag Archives: This application has no explicit mapping for /error

This application has no explicit mapping for /error, so you are seeing this as a fallback.

This exception indicates that the URL of the jump page has no corresponding value

Reason 1:

The location of the application startup class is incorrect. Put the application class on the outermost side, that is, it contains all sub packages
reason: spring boot will automatically load all components under the package where the startup class is located and its sub packages

Reason 2:

In the springboot configuration file: application.yml or application.properties, about the configuration of the view parser:
when the spring boot starter paren version in the POM file is higher:
spring.mvc.view.prefix/spring.mvc.view.suffix
when the spring boot starter paren version in the POM file is low, use:
spring.view.prefix/spring.view.suffix

Reason 3:

URL path writing problem of controller
@RequestMapping(“xxxxxxxxxxxxxx”)
the actual access path does not match “XXX”

This application has no explicit mapping for /error, so you are seeing this as a fallback

Build spring boot backend service, enter url, can’t access, prompt.

This application has no explicit mapping for /error, so you are seeing this as a fallback

Code:

@Controller
@SpringBootApplication
@RequestMapping("/webapp")
public class WebappApplication {

	@RequestMapping("/")
	String index() {
		System.out.println("login redirectx。。。");
		return "login";
	}

However, when you observe the output of the background, it shows that you have entered the method corresponding to the @ requestmapping path. Why does the browser not return the expected information (string “login”) but prompt 404 instead

After a period of trial and exploration, the solution is found

Change @ controller to @ restcontroller

@The controller treats the returned information as a URL

@Restcontroller returns information directly as content

The problem is solved and the information is returned successfully