成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術文章
文章詳情頁

詳解IDEA搭建springBoot方式一(推薦)

瀏覽:9日期:2023-04-17 17:34:52

1.先在IDEA配置maven

詳解IDEA搭建springBoot方式一(推薦)

maven下載和配置可以看https://www.jb51.net/article/197309.htm

2.新建maven項目

詳解IDEA搭建springBoot方式一(推薦)詳解IDEA搭建springBoot方式一(推薦)

3.在pom.xml加入springBoot依賴

詳解IDEA搭建springBoot方式一(推薦)

<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.創建類(用來啟動項目),寫如下代碼

詳解IDEA搭建springBoot方式一(推薦)

package xiaoliu;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationpublic class SpringApplicationTest { public static void main(String[] args) { //啟動spring應用 SpringApplication.run(SpringApplicationTest.class,args); }}

5.創建Controller 寫代碼如下

詳解IDEA搭建springBoot方式一(推薦)

5.運行

詳解IDEA搭建springBoot方式一(推薦)詳解IDEA搭建springBoot方式一(推薦)

6.訪問項目

在頁面中輸入http://localhost:8080/hello 即可訪問項目。

詳解IDEA搭建springBoot方式一(推薦)

可以用idea 打包 成jar然后用 java -jar hello.jar 運行springboot 項目springboot中已經自帶了tomcat,所以可以沒有tomcat環境

到此這篇關于IDEA搭建springBoot方式一的文章就介紹到這了,更多相關IDEA搭建springBoot內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章: