SpringBoot中集成thymeleaf模板
pom.xml中添加:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>
想要直接访问resources中templates中的页面:需要在修改main/resources/application.properties添加一行:
配不配值都可以:
#spring.thymeleaf.prefix=classpath:/templates/ #spring.thymeleaf.suffix=.html #spring.thymeleaf.cache=false #spring.thymeleaf.servlet.content-type=text/html spring.resources.static-locations=classpath:/templates/,classpath:/static