1. 程式人生 > >(一)IDEA工具開第一個springboot應用之helloworld

(一)IDEA工具開第一個springboot應用之helloworld

control api 結構 spring maven https tro idt .cn

(一)IDEA工具開第一個springboot應用之helloworld

一、前置知識  

  1、maven相關知識

  2、spring註解

  3、RESTful API

二、idea開發第一個springboot的應用helloworld

  idea官網:https://www.jetbrains.com/idea/

1、新建工程

  springboot基於jdk1.8

技術分享

2、創建項目名稱

技術分享

3、選擇maven的pom文件的依賴

技術分享

4、選擇項目存放路徑

技術分享

5、本地maven配置阿裏雲的maven鏡像

技術分享

6、刪除不需要的文件

技術分享

7、項目結構

技術分享

8、啟動項目

技術分享

8、項目正常啟動,端口為8080

技術分享

9、瀏覽器訪問測試,地址localhost:8080,返回404,表示項目啟動正常

技術分享

10、新建類HelloController

@RestController
public class HelloController {

    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String  say (){
        return "hello spring boot!";
    }
}

11、啟動項目再次訪問,地址:http://localhost:8080/hello

技術分享

簡單的springboot入門案例到此完成

(一)IDEA工具開第一個springboot應用之helloworld