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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM