spring boot 系列學習記錄:http://www.cnblogs.com/jinxiaohang/p/8111057.html
碼云源碼地址:https://gitee.com/jinxiaohang/springboot
?
一、Spring Initializr 使用教程 (IntelliJ IDEA)
具體步驟:
1、打開IDEA ,Create New Project 或者?File -> New - > Project。
?
2、填寫組織信息,工程名稱,打包類型選擇Jar。
?
3、選取依賴,這里我們選擇Web依賴。
?
4、核對工程名稱和工程路徑,默認不變
?
5、測試程序能否正常運行
?
二、Spring Initializr 使用教程 ( Eclipse )
具體步驟:
步驟1 : 使用瀏覽器打開:?http://start.spring.io
步驟2 : 填寫項目相關信息,選取依賴,然后生成項目。
步驟3 : 解壓項目,在Eclipse導入Maven工程。
?
二、實現helloworld
1、編輯SpringbootHelloworldApplication類
package com.xiaohang.springboothelloworld;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ResponseBody;@SpringBootApplication @Controller public class SpringbootHelloworldApplication {@GetMapping("/")@ResponseBodypublic String index() {return "Hello World!";}public static void main(String[] args) {SpringApplication.run(SpringbootHelloworldApplication.class, args);} }
2、啟動項目,訪問localhost:8080
效果如上。
?