eclipse創建springBoot項目


創建Spring Boot 工程

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


5



2、Packaging 選擇 jar

 

6



3、勾選Web 項

 

7



4、項目結構

 

8


 

啟動項目


1、創建 HelloController.java

 

9

 

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

 

10



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

 

11



4、訪問網頁

http://localhost:8080/hello/sts

 

12


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM