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

 

posted @ 2020-05-25 07:11  生如逆旅,一苇以航  阅读(214)  评论(0编辑  收藏  举报