TemplateInputException—spring boot部署中一个斜杠引发的血案

异常现象:在本地打包部署完全没有问题,资源文件也都可以映射上,但是打包成jar包部署到服务器上时,就一直报异常,异常信息如下:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/content/content], template might not exist or might not be accessible by any of the configured Template Resolvers

经过大量的排查,最终的问题出在

mv.setViewName("/content/content");

这行代码,去掉最前面的"/"就好了!


image.png
公众号.png

你可能感兴趣的:(TemplateInputException—spring boot部署中一个斜杠引发的血案)