springboot项目启动,但是访问报404错误

启动类Application上加了@ComponentScan(basePackages = {})这个注解导致controller扫描不到导致的,如果加了这个注解,springboot就不会扫描Application所在的包及子包的文件,需要将controller所在的包加入到注解@ComponentScan的大括号中

原文地址:https://www.cnblogs.com/jpfss/p/11171612.html