其他分享
首页 > 其他分享> > SpringBoot项目访问网页空白页报错:Whitelabel Error PageThis application has no explicit mapping for /error

SpringBoot项目访问网页空白页报错:Whitelabel Error PageThis application has no explicit mapping for /error

作者:互联网

刚开始搭建Spring Boot 微服务,页面报

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

Sat Feb 29 16:42:04 CST 2020
There was an unexpected error (type=Not Found, status=404).
No message available

 经过排查,总结原因有三

方法1:看是否在\src\test\java\com\example\demo目录下创建了controller包,在controller包里创建Controller类

 

方法2:是否地址输入错误

http://localhost:8080/demo

这里的“/demo”取决于HelloController类中 @RequestMapping("/demo") 引号里的内容!

 

方法3:是否正确编辑XXXXXApplication类

新建的springboot项目,其中的XXXXApplication类是不跟controller包同一级别的,是需要将XXXXApplication类放在上一层中,像我这样的新手就往往直接拉出来,

忽略了修改所在的包路径

 

标签:demo,Error,Whitelabel,application,controller,报错,error,PageThis
来源: https://www.cnblogs.com/guohaoshi187/p/16514633.html