前提:
開發(fā)工具: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項(xiàng)目,會(huì)自動(dòng)生成application.properties.
使用application.properties配置文件之后,spring boot啟動(dòng)時(shí),會(huì)自動(dòng)把配置信息讀取到spring容器中,并覆蓋spring boot的默認(rèn)配置。
3、在配置文件中,設(shè)置以下兩個(gè)參數(shù)
1
2
3
4
|
#設(shè)定ftl文件路徑 spring.freemarker.template-loader-path=classpath:/templates #設(shè)定靜態(tài)文件路徑,js,css等 spring.mvc.static-path-pattern=/static/** |
controller跳轉(zhuǎn)頁面如下:
templates/action/list.ftl頁面
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。
原文鏈接:http://www.cnblogs.com/nannan0226/p/6400273.html