1. 程式人生 > >創建Spring Boot 工程

創建Spring Boot 工程

jar 成功 ID tca XA cati framework 新建 jsb

先在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插件";  
    }  
}



2、運行 DemoApplication.java文件 或者 右鍵項目 Run As -> Spring Boot App

技術分享圖片



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

技術分享圖片



4、訪問網頁

http://localhost:8080/hello/sts

技術分享圖片

創建Spring Boot 工程