Spring-Boot "Whitelabel Error Page" 解决方法总结

来源:互联网 发布:台湾已经独立了知乎 编辑:程序博客网 时间:2024/05/17 20:33

初学Spring-Boot, "Whitelabel Error Page"是很多人碰到的第一个头痛的问题

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Apr 09 13:02:50 CST 2017
There was an unexpected error (type=Internal Server Error, status=500).
No message available

这一般是因为,通过Application无法找到controller造成的。

解决方式如下:

1. Application中需要在包结构的最上层
2. Application中引入注解,并加上Controller的包目录 @ComponentScan(basePackages= {"org.xxxx.ad.controller"})
3. Application上加入注解@SpringBootApplication
4. Application扩展SpringBootServletInitializer
阅读全文
0 0