SpringBoot使用Thymeleaf打成jar包部署找不到页面


SpringBoot使用Thymeleaf打成jar包部署找不到页面

使用SpringBoot+Thymeleaf时,在IDEA中运行正常,但打成Jar包运行时,报错:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/wx/auth], 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]

解决方案:

  • 1.确认模板文件是否在templates文件夹里
  • 2.返回路径"/wx/auth"这样写是不对的,要把斜杠去掉"wx/auth"


免责声明!

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



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