org.thymeleaf.exceptions.TemplateInputException: Error resolving template [outbound], template might

梦里梦外; 2022-11-13 04:12 250阅读 0赞

使用thymeleaf错误
Error resolving template [outbound], template might not exist or might not be accessible by any of the configured Template Resolvers
Error resolving template [outbound], template might not exist or might not be accessible by any of the configured Template Resolvers

解析模板[outbound]时出错,模板可能不存在,或者任何已配置的模板解析程序都无法访问该模板

  1. Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79b19d5]
  2. Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79b19d5]
  3. Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79b19d5]
  4. Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@79b19d5]
  5. 2021-03-25 13:46:19.318 ERROR 11176 --- [nio-8088-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-8088-exec-1] Exception processing template "outbound": Error resolving template [outbound], template might not exist or might not be accessible by any of the configured Template Resolvers
  6. org.thymeleaf.exceptions.TemplateInputException: Error resolving template [outbound], template might not exist or might not be accessible by any of the configured Template Resolvers
  7. at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  8. at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  9. at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  10. at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  11. at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) [thymeleaf-spring5-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  12. at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) [thymeleaf-spring5-3.0.12.RELEASE.jar:3.0.12.RELEASE]
  13. at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1393) [spring-webmvc-5.3.5.jar:5.3.5]
  14. at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1138) [spring-webmvc-5.3.5.jar:5.3.5]
  15. at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1077) [spring-webmvc-5.3.5.jar:5.3.5]
  16. at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:962) [spring-webmvc-5.3.5.jar:5.3.5]
  17. at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.5.jar:5.3.5]
  18. at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) [spring-webmvc-5.3.5.jar:5.3.5]
  19. at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) [tomcat-embed-core-9.0.44.jar:4.0.FR]
  20. at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.3.5.jar:5.3.5]
  21. at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) [tomcat-embed-core-9.0.44.jar:4.0.FR]

解决方法:
在这里我分享一下我解决了bug之后的方法
检查自己的controller,看一下return的路径是否有问题?
再检查一下properties文件的配置是否齐全:

  1. # 配置thymeleaf
  2. spring.thymeleaf.prefix=classpath:/templates/view/ # 对应你的templates路径
  3. spring.thymeleaf.suffix=.html # 对应你的视图后缀
  4. spring.thymeleaf.mode=HTML5
  5. spring.thymeleaf.check-template=true
  6. spring.thymeleaf.encoding=UTF-8
  7. spring.thymeleaf.cache=false
  8. spring.thymeleaf.servlet.content-type=text/html
  9. spring.web.resources.static-locations=classpath:/templates/,classpath:/static/

发表评论

表情:
评论列表 (有 0 条评论,250人围观)

还没有评论,来说两句吧...

相关阅读