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

在学习SpringBoot的时候出现了以下提示:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Apr 03 13:35:35 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
如果mapping没写错的话
原因很可能是所写代码不在Application(主配置类)的包及子包下。
SpringBoot中约定大于配置,很多时候注解解决的问题就不需要xml文件来配置了。
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as_第1张图片
主配置类上该注解点进去后发现该注解是一个注解类等于实现了以下一大堆的注解Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as_第2张图片
其中有一个注解是自动配置
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as_第3张图片
该类中有方法可以找到主配置类的包名Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as_第4张图片
matadata的全限定类名如下取包名后得到了主配置类的包名在这里插入图片描述这时候Springboot就会将该包及其子包加入到Spring容器中

你可能感兴趣的:(Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as)