1. 程式人生 > >SpringBoot2.x入門(一)[HelloWorld程式]

SpringBoot2.x入門(一)[HelloWorld程式]

雲盤地址(版本為17版本)

連結:https://pan.baidu.com/s/1dOxiPSaJGnlLoY73FhXZvw  提取碼:m3mm 

使用idea:file-->new-->project

選擇:spring Assistant

選擇完成之後 next 就ok

填寫相關專案內容:

next-->選擇web

next

然後開啟 目錄如下

建立controller包

建立 

HelloWorldController
package com.yst.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWorldController {

    @RequestMapping("/")
    public String helloTest(){
        return "hello world";
    }
}

找到啟動類 點選啟動按鈕

啟動完成

訪問localhost:8080

HelloWorld完成