使用 IDEA 直接創(chuàng)建項(xiàng)目
1、創(chuàng)建一個(gè)新項(xiàng)目
2、選擇spring initalizr
選擇初始化組件Web
等待項(xiàng)目構(gòu)建成功
在com.longdi.helloworld包下新建一個(gè)HelloController類
package com.longdi.helloworld.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author: 弟 * @description * @date: 2021/9/29 13:03 */ @RestController public class HelloController { //接口:http://localhost:8080/hello @RequestMapping("hello") public String hello(){ //調(diào)用業(yè)務(wù),接收前端的參數(shù) return "hello world"; } }
項(xiàng)目結(jié)構(gòu)
啟動(dòng)項(xiàng)目,即可在瀏覽器顯示HelloWorld!
http://localhost:8080/hello
只需要幾步,就可以完成一個(gè)web接口的開發(fā),SpringBoot就是這么簡單
將項(xiàng)目打成jar包,點(diǎn)擊 maven的 package
如果打包成功,則會(huì)在target目錄下生成一個(gè) jar 包
打成了jar包后,就可以在任何地方運(yùn)行了!
如何更改啟動(dòng)時(shí)顯示的字符拼成的字母,也就是 banner 圖案
只需一步:到項(xiàng)目下的 resources 目錄下新建一個(gè)banner.txt 即可。
SpringBoot操作起來如此簡單,我們之后去進(jìn)行一波源碼研究分析!
歡迎來我的Github:https://github.com/dragon-idea
到此這篇關(guān)于一分鐘入門Java Spring Boot徹底解決SSM配置問題的文章就介紹到這了,更多相關(guān)Java Spring Boot SSM 配置內(nèi)容請搜索服務(wù)器之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持服務(wù)器之家!
原文鏈接:https://blog.csdn.net/weixin_48838340/article/details/120549896