Spring运行报警告Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)

原因:

SpringBoot会自动从/src/main/resources/templates目录获取Thymeleaf模板引擎,若该目录缺失,就会报该警告。

 

方法1:

创建该目录

 

方法2:

在application.yml中加入以下配置:

  thymeleaf:
    check-template: false
    check-template-location: false

如果是application.properties,就是加入

spring.thymeleaf.check-template=false
spring.thymeleaf.check-template-location=false

 

方法3:

去掉pom.xml中的以下配置:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

 

posted @ 2022-01-11 01:22  Clotho_Lee  阅读(1854)  评论(0编辑  收藏  举报