Spring Boot整合Freemarker

将Spring Boot 和Freemarker  整合在一起,可以在Idea上通过File/New/Project

选择Spring Initializr 在Dependencies选项中选择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中通过返回页面路径来调用页面资源。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容