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??访问资源没找到。怎么可能呢
spring boot ---Whitelabel Error Page_第1张图片

 

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

spring boot ---Whitelabel Error Page_第2张图片

 

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

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

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

spring boot ---Whitelabel Error Page_第3张图片

 

 ok啦

spring boot ---Whitelabel Error Page_第4张图片

 

 

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

 

 

 

转载于:https://www.cnblogs.com/gqblogs/p/springboot_WhitelabelErrorPage.html

你可能感兴趣的:(spring boot ---Whitelabel Error Page)