Java教程

SpringBoot无法访问接口,报错:This application has no explicit mapping for /error, so you are seeing this as a

本文主要是介绍SpringBoot无法访问接口,报错:This application has no explicit mapping for /error, so you are seeing this as a,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

问题

SpringBoot启动后,无法访问接口,报错如下:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
There was an unexpected error (type=Not Found, status=404).
No message available

解决方法

(1)检查SpringBoot的启动类Application类,有没有放在最外层。

展开项目的java文件夹下面的com文件后,就能看出Application类。
Application类跟service、controller等文件夹是在同一层的。如下:

(2)检查url的路径

检查url的路径,是否跟@RequestMapping的路径一致,GET、POST是否一致,参数是否一致。

参考资料:

https://www.cnblogs.com/lilinzhiyu/p/7921890.html

这篇关于SpringBoot无法访问接口,报错:This application has no explicit mapping for /error, so you are seeing this as a的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!