創建Spring Boot 工程
先在eclipse中安裝spring -tool -suite插件,然后根據以下步驟可以創建
1、新建Spring Starter Project

2、Packaging 選擇 jar

3、勾選Web 項

4、項目結構

啟動項目
1、創建 HelloController.java

package com.example.demo; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/hello") public class HelloController { @RequestMapping("/sts") public String helloworld(){ return "使用spring-tool-suite插件"; } }
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
2、運行 DemoApplication.java文件 或者 右鍵項目 Run As -> Spring Boot App

3、打印輸出:Started DemoApplication in 3.977 seconds (JVM running for 6.73) 說明項目啟動成功。

4、訪問網頁

