前提:
開發工具:idea
框架:spring boot、maven
1、pom文件添加依賴
1
2
3
4
5
|
< dependency > < groupId >org.springframework.boot</ groupId > < version >1.4.1.RELEASE</ version > </ dependency > |
2、新建spring web項目,會自動生成application.properties.
使用application.properties配置文件之后,spring boot啟動時,會自動把配置信息讀取到spring容器中,并覆蓋spring boot的默認配置。
3、在配置文件中,設置以下兩個參數
1
2
3
4
|
#設定ftl文件路徑 spring.freemarker.template-loader-path=classpath:/templates #設定靜態文件路徑,js,css等 spring.mvc.static-path-pattern=/static/** |
controller跳轉頁面如下:
templates/action/list.ftl頁面
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持服務器之家。
原文鏈接:http://www.cnblogs.com/nannan0226/p/6400273.html