I. Error Prompt:
Ii. Reasons:
Iii. Solution 1: Package of the mobile control layer:
4. Solution 2: Add @SpringBootApplication(scanBasePackages=” Controller “)
5. Summarize the reasons for possible errors:
Reason 1:
Reason 2:
Reason 3:
Vi. Cause of Error of Eclipse starting Springboot:
An error was reported when Springboot was running, other configurations were fine, and after a long look I found the cause.
I. Error Prompt:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Jun 24 14:56:23 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
Ii. Reasons:
Problem with IDEA directory structure, the location of the Application startup class is wrong. To place the Application class on the outermost side, it contains all the subpackages. And my Controller is in the outermost package. The page could not be found.
Iii. Solution 1: Package of the mobile control layer:
Move the Controller class in, and it will run successfully.
Refresh again and the page will open successfully.
4. Solution 2: Add @SpringBootApplication(scanBasePackages=” Controller “)
In your Demo01Application class that you started, add a comment specifying the location of your Controller, and you can specify the load and solve the problem successfully.
package com.hh.demo01;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages="controller")
public class Demo01Application {
public static void main(String[] args) {
SpringApplication.run(Demo01Application.class, args);
}
}
5. Summarize the reasons for possible errors:
This exception indicates that the url for the jump page has no corresponding value.
Reason 1:
The Application startup class is not in the right place. To place the Application class on the outermost side, it contains all subpackages
reason :spring-boot automatically loads all components under the package where the startup class is located and under its subpackages.
Reason 2:
In springboot configuration file: application. Yml or application. The properties on the view of the parser configuration problem:
when the spring under the pom file – the boot – starter – paren version used when high:
spring. MVC. The prefix/spring. MVC. The suffix
As spring under the pom file – the boot – starter – paren version low when use:
spring. The prefix/spring. The suffix
Reason 3:
Controller URL path writing problem
@RequestMapping(” XXXXXXXXXXXXXX “)
actual access path and “XXX” does not conform.
Refer to the article: https://www.cnblogs.com/lilinzhiyu/p/7921890.html
Vi. Cause of Error of Eclipse starting Springboot:
When the eclipse deployed project is launched, This application has no explicit mapping for /error, so you are seeing This as a fallback. At the same time, his log shows port 8080 being started.
And my configuration file has configured the port:
Later, it turned out that it was also because of the location of the package, that is, the above reason 1: the location of the Application startup class is wrong. To place the Application class on the outermost side, you include all subpackages because Spring-Boot automatically loads all components under the package where the startup class is located and under its subpackages.
After changing the position, it starts successfully, and the port is correct and the page is opened correctly.
Personal Summary:
I’m going to have to do some careful checking.