1、Thymeleaf
application的属性properties文件上配置 thymeleaf 相关属性
##thymeleaf start
#spring.thymeleaf.mode=HTML5
#spring.thymeleaf.encoding=UTF-8
#spring.thymeleaf.content-type=text/html
##开发时关闭缓存,不然没法看到实时页面
#spring.thymeleaf.cache=false
#spring.thymeleaf.prefix=classpath:/templates/
#spring.thymeleaf.suffix=.html
##thymeleaf end
2、springboot1.5和以上版本 已经完全抛弃了velocity视图模板
方法:
(1)引入jar 带版本号的
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-velocity</artifactId> <version>1.2.2.RELEASE</version> </dependency>
(3)将xml 引入到项目中
@ServletComponentScan @SpringBootApplication @ImportResource({"classpath:application-b.xml"}) public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }