您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關Intellij IDEA如何創(chuàng)建spring-boot項目,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
開發(fā)環(huán)境:
jdk版本:JDK8
maven版本:maven-3.5.2
開發(fā)工具:Itellij IDEA 2017.1
前提條件:已安裝以上軟件并配置好jdk和maven的環(huán)境變量
創(chuàng)建步驟:
點擊坐上角file ---》選擇new ---》點擊project... 如下圖所示:
點擊左邊Spring Initializr ---》 右上角新建jdk(若有則不需要) ---》 點擊next 如下圖所示:
看需求修改下圖中的信息后點擊next(可以直接使用默認)
點擊左邊的Web ---》 選中中間列的Web ---》 點擊next 如下圖所示:
輸入項目名稱和保存路徑 --- 》點擊finish
創(chuàng)建的項目如下圖所示:
創(chuàng)建HelloController類,代碼如下所示:
package com.example.demo.controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/hello") public class HelloController { @RequestMapping("/say") public String sayHello() { return "hello world"; } }
執(zhí)行DemoApplication中main方法后訪問http://localhost:8080/hello/say 頁面如下所示:
關于“Intellij IDEA如何創(chuàng)建spring-boot項目”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。