spring boot ---Whitelabel Error Page

想试一下spring boot的hello world,可是出错了

错误:

Whitelabel Error Page

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

Mon Oct 29 09:55:25 CST 2018
There was an unexpected error (type=Not Found, status=404).
No message available
 
 
404??访问资源没找到。怎么可能呢

 

经过网上搜索终于找到原因了,controller必须在spring boot的启动程序的包或子包

 

 新建一个包com.exammple.demo.controller

将IndexController.java移到com.example.demo.controller下

然后访问http://localhost:8080/

 

 ok啦

 

 

附上我找到的答案地址:https://blog.csdn.net/kmesky/article/details/80019993

 

 

 

posted @ 2018-10-29 10:10  gulchan  阅读(278)  评论(0编辑  收藏  举报