將Spring Boot 和Freemarker? 整合在一起哲银,可以在Idea上通過File/New/Project
選擇Spring Initializr 在Dependencies選項(xiàng)中選擇Template Engines勾選Freemarker。
這樣,在pom.xml中,會自動添加
<dependency>
????????<groupId>org.springframework.boot</groupId>
????????<artifactId>spring-boot-starter-freemarker</artifactId>
</dependence>
也可自行在pom.xml中添加东涡。
之后长踊,在application.properties中,添加springfreemarker.template-loader-path=classpath:/template/
之后就可以通過在template文件夾下添加ftl文件棺棵,在controller中通過返回頁面路徑來調(diào)用頁面資源。