Cannot connect to localhost:8080
1 |
|
< /figure>
This code in pom.xml is changed to
< pre>1 2 3 4 |
|
The difference between spring-boot-starter and spring-boot-starter-web:
- spring-boot-starter is the core starter of Spring Boot, including automatic configuration, logging and YAML
- spring-boot-starter-web supports full-stack web development, including Tomcat And spring-webmvc
Related reference
Detailed explanation of Spring Boot’s Starter
Whitelabel Error Page appears when visiting localhost:8080
You need to enter the annotation @RequestMapping("/")
in the class to map the address, In order to use @RequestMapping("/")
, the org.springframework.web.bind.annotation.RequestMapping package must be imported in the header.
The @RestController
annotation is equivalent to the combination of @[email protected]. The methods in the class using this annotation are output in json format and must be imported in the header import the org.springframework.web.bind.annotation.RestController package.
If you have started the project before importing the package, you need to use maven reimport to update the dependent package, otherwise an error will be reported.
Original text: Big column Problems encountered in initializing spring boot