詳解IDEA搭建springBoot方式一(推薦)
1.先在IDEA配置maven
maven下載和配置可以看https://www.jb51.net/article/197309.htm
2.新建maven項(xiàng)目
3.在pom.xml加入springBoot依賴(lài)
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
4.創(chuàng)建類(lèi)(用來(lái)啟動(dòng)項(xiàng)目),寫(xiě)如下代碼
package xiaoliu;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class SpringApplicationTest { public static void main(String[] args) { //啟動(dòng)spring應(yīng)用 SpringApplication.run(SpringApplicationTest.class,args); }}
5.創(chuàng)建Controller 寫(xiě)代碼如下
5.運(yùn)行
6.訪(fǎng)問(wèn)項(xiàng)目
在頁(yè)面中輸入http://localhost:8080/hello 即可訪(fǎng)問(wèn)項(xiàng)目。
可以用idea 打包 成jar然后用 java -jar hello.jar 運(yùn)行springboot 項(xiàng)目springboot中已經(jīng)自帶了tomcat,所以可以沒(méi)有tomcat環(huán)境
到此這篇關(guān)于IDEA搭建springBoot方式一的文章就介紹到這了,更多相關(guān)IDEA搭建springBoot內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. ASP.NET MVC實(shí)現(xiàn)樹(shù)形導(dǎo)航菜單2. 多級(jí)聯(lián)動(dòng)下拉選擇框,動(dòng)態(tài)獲取下一級(jí)3. 如何封裝一個(gè)Ajax函數(shù)4. jsp網(wǎng)頁(yè)實(shí)現(xiàn)貪吃蛇小游戲5. Ajax常用封裝庫(kù)——Axios的使用6. jsp+servlet簡(jiǎn)單實(shí)現(xiàn)上傳文件功能(保存目錄改進(jìn))7. CSS Hack大全-教你如何區(qū)分出IE6-IE10、FireFox、Chrome、Opera8. WML學(xué)習(xí)之七 CGI編程9. Vue實(shí)現(xiàn)用戶(hù)沒(méi)有登陸時(shí),訪(fǎng)問(wèn)后自動(dòng)跳轉(zhuǎn)登錄頁(yè)面的實(shí)現(xiàn)思路10. 微信開(kāi)發(fā) 網(wǎng)頁(yè)授權(quán)獲取用戶(hù)基本信息
