使用spring initializr ( 4.快速创建springboot工程 )(入门结束)
生活随笔
收集整理的這篇文章主要介紹了
使用spring initializr ( 4.快速创建springboot工程 )(入门结束)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
?
組織id??com.tabctrlshift
模塊id??spring-boot-01-helloworld-quick
可以看看下面的東西
最終只選擇web
選擇我們需要的模塊即可
wokao,就這樣聯網自動生成了!
用不上的刪掉
?
?選擇彈出的自動導入。
萬一沒有選中這里有個刷新圖標手動刷新導入
新建一個HelloController類
package com.tabctrlshift.springboot.controller;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;這個類的所有方法返回數據直接寫給瀏覽器,如果是對象轉為json數據
//@ResponseBody
//@Controller
//以上兩者的合并寫法
@RestController
public class HelloController {// 要寫給瀏覽器
// @ResponseBody
// 處理hello請求@RequestMapping("/hello")public String Hello(){return "hello";}
}
ok。
主程序已經寫好了,只需要寫業務邏輯 。
?
如果用sts就是生成spring starter project
?
轉載于:https://www.cnblogs.com/tabCtrlShift/p/9069937.html
總結
以上是生活随笔為你收集整理的使用spring initializr ( 4.快速创建springboot工程 )(入门结束)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 缅甸花梨木目前的价格一吨多少钱
- 下一篇: 整个瓜子脸要多少钱?