1.下载依赖
2.Create a Simple Web Application
src/main/java/com/example/springboot/HelloController.java
3.Create an Application class
src/main/java/com/example/springboot/Application.java
4.Run the Application
mvnw spring-boot:run
curl localhost:8080
5.Add Unit Tests
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
src/test/java/com/example/springboot/HelloControllerTest.java
src/test/java/com/example/springboot/HelloControllerIT.java
6.Add Production-grade Services
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
mvnw spring-boot:run
curl localhost:8080/actuator/health
curl -X POST localhost:8080/actuator/shutdown
7.JAR Support and Groovy Support
@RestController
class ThisWillActuallyRun {
@GetMapping("/")
String home() {
return "Hello, World!"
}
}