首页 > 编程语言 > 详细

Spring boot + Freemarker 整合

时间:2018-04-20 17:45:15      阅读:190      评论:0      收藏:0      [点我收藏+]

1.首先要添加freemarker依赖包

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>

2.在appliaction.yml加入freemarker配置文件

spring:
  freemarker:
request-context-attribute: req #req访问request
suffix: .html #后缀名
content-type: text/html
enabled: true
cache: false #缓存配置
template-loader-path: classpath:/templates/ #模板加载路径 按需配置
charset: UTF-8 #编码格式
settings:
number_format: ‘0.##‘ #数字格式化,无小数点

如果只是用mvc 则只要在appliaction.yml配置,默认访问templates路径下文件
mvc:
view:
prefix:
suffix: .htm

Spring boot + Freemarker 整合

原文:https://www.cnblogs.com/leeIndex/p/8892156.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!