项目背景:springboot+thymeleaf
本地运行正常,打包部署服务器后访问页面500错误
接口正常
报错页面如下:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Jan 13 18:58:14 CST 2020
There was an unexpected error (type=Internal Server Error, status=500).
Error resolving template [/web/plant/index], template might not exist or might not be accessible by any of the configured Template Resolvers

解决方法:
把"/"去掉
错误:@RequestMapping("/web/main")
错误:return "/web/index";
正确:@RequestMapping("web/main")
正确:return "web/index";
本文解决了一个关于SpringBoot结合Thymeleaf在服务器部署后出现的500错误问题,详细介绍了如何调整@RequestMapping注解和返回视图路径来避免WhitelabelErrorPage错误。

357

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



