错误类型:Exception processing template "xxx": Error resolving template [xxx], template might not exist or might not be accessible by any of the configured Template Resolvers


初学SpringBoot+Thymeleaf,在写项目时遇到如下错误:

[THYMELEAF][http-nio-8081-exec-6]
Exception processing template "xxx": Error resolving template [xxx], template might not exist or might not be accessible by any of the configured Template Resolvers
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [homepage], template might not exist or might not be accessible by any of the configured Template Resolvers
	at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]

问题根源:

以下是我在配置文件中写存放路径(参见Spring Boot企业级开发教程 黑马程序员编著)

spring.thymeleaf.prefix= classpath:resources/templates/

解决方法

修改为

spring.thymeleaf.prefix= classpath:/templates/


免责声明!

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



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