在main的启动类上添加
@SpringBootApplication(scanBasePackages = {"com.shangsheng"})或者@ComponentScan("com.shangsheng")注意:只能写两个包的连接点,不能写到最低包,不然扫描不到