最近在項目中實踐了一下Springboot2,在此寫一個Springboot2實踐專欄,方便用到的小夥伴參考。本專欄文章在一個Maven Project中建立不一樣的Modules來描述Springboot2的各個技術點的實踐方法。後續會對每個技術點原理進行探究。筆者在mac上用idea開發,因此工程基於idea和java8建立。
<packaging>pom</packaging>
-src -main -java -com.firefly.hellofirefly #主函數,啓動類 -HellofireflyApplication -resouces #存放靜態資源 js/css/images 等 -static #存放 html 模板文件 -templates #主要的配置文件,SpringBoot啓動時候會自動加載application.properties - application.properties #測試文件存放目錄 -test # pom.xml 文件是Maven構建的基礎,裏面包含了咱們所依賴JAR和Plugin的信息 - pom
由於Springboot內置Tomcat,咱們看到默認啓動的端口也是8080css
@RestController public class HelloFireFlyController { @GetMapping("/hello") public String helloFireFly() { return "~~ Hello,FireFly ~~"; } }
# server server.port=9099 #編碼格式 server.tomcat.uri-encoding=utf-8
http://patorjk.com/software/t...
https://github.com/qiuchunwei...