码迷,mamicode.com
首页 > 编程语言 > 详细

Spring boot + Freemarker 整合

时间:2018-04-20 18:01:11      阅读:209      评论:0      收藏:0      [点我收藏+]

标签:class   格式化   enc   ext   AC   char   att   加载   添加   

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 整合

标签:class   格式化   enc   ext   AC   char   att   加载   添加   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!