SpringBoot无法访问接口,报错:This application has no explicit mapping for /error, so you are seeing this as a fallback.
问题
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是否一致,参数是否一致。