1:默认扫描启动类所在路径下所有的bean 2:可以在启动类中添加注解,手动指定扫描路径: @ComponentScan(basePackages = {"com.xxx.service1.*","com.xxx.service2.**"})