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

After running the project main program class SpringBootApplication, when http://localhost:8080/helloaccessing, the following error is reported:
insert image description here
This application has no explicit mapping for /error, so you are seeing this as a fallback.
The reason for this error is that the location of the startup class is wrong: the
annotation added here will scan all the components in the package of the main configuration class (the class marked by SpringBootApplication) and all the subpackages below to the Spring container;

insert image description here

To place the main program class in the outer layer, the package and sub-package components can be scanned. After changing the location, start the access again:

insert image description here

success.

Guess you like

Origin blog.csdn.net/quanqxj/article/details/104185183