错误信息:
Error resolving template "aaaa", template might not exist or might not be accessible by any of the configured Template Resolvers
我的配置:

controller:

项目目录:

但是浏览器输入:http://192.168.1.35:8080/team/toAdd 访问的时候出现了上面的错误:

最后网上百度找到了答案!在此记录一下:
因为默认的路径是spring.thymeleaf.prefix=classpath:/templates/ 你再写/就多出一个斜杠了
所以,我的问题是,application.yml 中配置的 spring.thymeleaf.prefix=classpath:/templates
我这里最后没有加 / ,所以导致找不到页面。修改后的配置如下:

controller:


本文记录了一次在Spring Boot项目中遇到Thymeleaf模板无法解析的问题,错误信息为'Error resolving template aaaa template might not exist or might not be accessible by any of the configured TemplateResolvers'。问题根源在于application.yml配置文件中的spring.thymeleaf.prefix缺少了末尾的'/'。修正配置后,问题得到解决。提醒开发者注意路径配置的细节,避免类似错误。
1万+

被折叠的 条评论
为什么被折叠?



