报错内容如下:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Wed Jul 10 17:52:57 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
头一次使用spring boot就报错,根据网上查找好多方法没有解决掉,最后将拦截类的
@Controller 修改为 @RestController 就不报错了,
如果是web访问页面的话需要使用@Controller,而不能使用@RestController
原因:技术知识点不够
本文探讨了在SpringBoot框架下,使用@Controller与@RestController注解的区别。通过一个具体案例,详细解释了当使用不同注解时,应用程序如何响应web请求,以及为何使用@RestController可以避免404错误。
5万+

被折叠的 条评论
为什么被折叠?



