SpringBoot启动报错This application has no explicit mapping for /error.....

Posted 狗狗听话 走在路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringBoot启动报错This application has no explicit mapping for /error.....相关的知识,希望对你有一定的参考价值。

今天做SpringBoot小例子,在请求controller层的时候出现如下问题。

Whitelabel Error Page

 

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

Wed Dec 14 16:35:25 CST 2016
There was an unexpected error (type=Not Found, status=404).
No message available

 

问题很像是没有访问地址不对,第一感觉以为url写的不对。

其实不是,真正的原因是【Application启动类放的位置不对】要将Application放在最外层,也就是要包含所有子包。

比如你的groupId是com.google,子包就是所谓的com.google.xxx,所以要将Application类要放在com.google包下。

springboot会自动加载启动类所在包下及其子包下的所有组件.

以上是关于SpringBoot启动报错This application has no explicit mapping for /error.....的主要内容,如果未能解决你的问题,请参考以下文章

springboot:This application has no explicit mapping for /erro

1. SpringBoot启动后,报异常:This application has no explicit mapping for /error, so you are seeing this as

springboot启动报错退出,To display the conditions report re-run your application with 'debug' enabl

spring boot启动报错 application startup failed怎么解决

spring boot启动报错application startup failed怎么解决?

SpringBoot的ApplicationRunner