目录
问题:
新手新建spring boot项目时可能在浏览器会看见这样的报错:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jan 09 09:49:32 CST 2025
There was an unexpected error (type=Not Found, status=404).
原因:
controller层的类没有写在创建boot项目时默认给的包里面,而是自己创建了一个controller包,且controller相关的类写在了这个包里面,就会出现找不到资源的问题。
解决办法1(强烈推荐):
在启动类里面加上包路径