Quickly create Hello World
1. Environmental preparation
- jdk
- maven
- idea
2. Open IDEA
1. New project
2. Select Spring Initializr
3. Configure project properties
- project name
- Package name
Java version select the version corresponding to your computer
4. Select Spring Web Components
5. Write Controller
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloController {
@GetMapping("hello")
public String hello(){
return "hello world!";
}
}
6. Run the project and visit in the browser
Run xxxApplication (xxx is the name corresponding to your own project)