多数原因是Bean没有正确注册,造成的原因有: 1、@ComponentScan('....')中省略号是不是没有写对 2、注解是不是没有加,例如@Component,@Service,@Controller,@Repository。