SpringBoot项目访问网页空白页报错:Whitelabel Error PageThis application has no explicit mapping for /error - guohao施 - 博客园

来源: SpringBoot项目访问网页空白页报错:Whitelabel Error PageThis application has no explicit mapping for /error – guohao施 – 博客园

刚开始搭建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类放在上一层中,像我这样的新手就往往直接拉出来,

忽略了修改所在的包路径

赞(1) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏