-
http://springboot.javaboy.org/2019/0412/springboot-init
maven 建立springboot2
建立完成後,在 pom.xml 檔案中,添加如下依賴:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
@EnableAutoConfiguration
@RestController
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
@GetMapping("/hello")
public String hello() {
return "hello";
}
}