springboot项目整合thymeleaf,在本地可以正常运行,部署到服务器报错
SpringBoot项目在本地正常运行,但是部署到服务器之后报错,报错信息是找不到模板
查看日志报错信息如下
org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/user/finance/paymoney], template might not exist or might not be accessible by any of the configured Template Resolvers
本地测试通过,部署到服务器就无法打开:
在查询网上各大佬的解决办法后,采取了在return的时候去掉字符串最前边的“/”。 是由于不同环境对路径的读取不同,而这个/导致jar在服务器读取不到
去掉之后,报错解决。
这是原先错误的:
修改过后的: