自己写的代码没问题,但是一直报404错误 问题原因:使用了@ComponentSacn()导致无法扫描到当前项目的controller层 解决问题:在@ComponentSacn()添加上controller所在包