spring boot 排除个别配置类的代码
废话不说,直接上代码
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class}) @EnableScheduling @ComponentScan(basePackages = {"com.hudai.platform.sms.vendor","com.hudai.platform.scp"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = com.hudai.platform.scp.alert.config.RestTemplateConfig.class)) public class SmsVendorApplication { public static void main(String[] args) { SpringApplication.run(SmsVendorApplication.class, args); } }
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = com.hudai.platform.scp.alert.config.RestTemplateConfig.class))
这段是经典