springboot配置freemarker使用application.properties
2019-01-19 16:38
489 查看
一、Maven添加引入`
<!-- freemarker --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency>
二、在application.properties文件中配置freemarker
spring.freemarker.template-loader-path=classpath:/templates/ spring.freemarker.charset=utf-8 spring.freemarker.cache=false spring.freemarker.expose-request-attributes=true spring.freemarker.expose-session-attributes=true spring.freemarker.expose-spring-macro-helpers=true spring.freemarker.suffix=.ftl
三、目录结构
四、控制器使用@Conntroller注解
五、页面部分
六、配置完成 运行
附:application.yml
spring: freemarker: allow-request-override: false cache: false check-template-location: true charset: utf-8 content-type: text/html expose-request-attributes: true expose-session-attributes: true expose-spring-macro-helpers: true suffix: .ftl template-loader-path: classpath:/templates/
相关文章推荐
- SpringBoot内部配置:“application.properties配置”和”使用XML配置”,读取属性文件中的内容,日志配置,Profile配置(学习:SpringBoot实战)
- springboot 修改默认端口及application.properties常用配置
- 【spring boot logback】日志使用自定义的logback-spring.xml文件后,application.properties中关于日志的相关配置还会起作用么
- 详解spring boot 使用application.properties 进行外部配置
- application.properties详解 --springBoot配置文件
- Spring Boot中配置文件application.properties使用
- [转]application.properties详解 --springBoot配置文件
- Spring配置文件中使用ref local与ref bean的区别. 在ApplicationResources.properties文件中,使用<ref bean>与<ref local>方法如下
- SpringBoot入门-8(使用properties进行配置)
- spring boot 使用application.properties 进行外部配置
- application.properties详解 --springBoot配置文件【转载】
- SpringBoot相关配置--application.properties/更改SpringBoot默认端口号
- Spring boot使用application.properties进行外部配置
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- spring boot 使用application.properties 进行外部配置
- SpringBoot入门-15(springboot配置freemarker使用YML)
- SpringBoot 配置文件application.properties
- springboot 修改默认端口及application.properties常用配置