SpringBoot-simple project creation

One, what is SpringBoot

Spring Boot is a brand new framework provided by the Pivotal team. Its design purpose is to simplify the initial setup and development of new Spring applications.

Two, install IntelliJ IDEA and Tomcat

Three, create a new Spring Boot project

Insert picture description here
Insert picture description here

Fourth, create a new UserController class

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
class UserController {
    
    
    @RequestMapping("/demo")
    public String getUserList() {
    
    
        return "hello world";
    }
}

5. Open the browser after running, enter http://localhost:8080/demo , and get the following results

Insert picture description here

6. The first pit stepped on:

1. After opening it, I found that my project DemoApplication was not imported. After a few searches, I found that it was because my Maven was not installed in the default location. You can change the following settings

Insert picture description here

2. The osbdLoggingFailureAnalysisReporter error occurs when running the project because port 8080 is occupied. The solution is to run the console as an administrator, close the port 8080 process, and rerun the project

netstat -ano | findstr 8080
taskkill /pid 13416 /f

Insert picture description here

7. Reference article: Use Spring Boot to build a simple background for Android App (1)

Guess you like

Origin blog.csdn.net/peixin_huang/article/details/109138667