【spring boot】第5篇:spring boot对模板引擎的支持

栏目: Java · 发布时间: 5年前

spring boot中支持哪些模板引擎

spring boot 整合 freemarker

添加 场景启动器

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

spring boot 如何配置 freemarker

  • FreeMarkerAutoConfiguration :自动配置,给容器中添加 freemarker 相关组件
  • FreeMarkerProperties :配置 freemarker 的相关属性
@ConfigurationProperties(prefix = "spring.freemarker")
public class FreeMarkerProperties extends AbstractTemplateViewResolverProperties {
    //模板文件存放的路径,存放在该默认路径的文件 freemarker会自动渲染
    public static final String DEFAULT_TEMPLATE_LOADER_PATH = "classpath:/templates/";

    public static final String DEFAULT_PREFIX = "";
    //模板文件默认后缀,可以在属性文件中配置覆盖
    public static final String DEFAULT_SUFFIX = ".ftl";
}

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Spring Into HTML and CSS

Spring Into HTML and CSS

Molly E. Holzschlag / Addison-Wesley Professional / 2005-5-2 / USD 34.99

The fastest route to true HTML/CSS mastery! Need to build a web site? Or update one? Or just create some effective new web content? Maybe you just need to update your skills, do the job better. Welco......一起来看看 《Spring Into HTML and CSS》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具