c语言sscanf函数的用法是什么
297
2022-12-22
Spring Boot 排除某个类加载注入IOC的操作
Spring Boot 排除某个类加载注入IOC
我们项目往往会引入其他项目的依赖,造成功能冲突的类,我们想把这些类排除掉,不注入到我们项目IoC容器中,
只加载自己的类
@ComponentScan(basePackages = "com.xxx",excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,classes = {
xxxPublisher.class,
xxxAdvice.class,
xxxService.class})})
其中这三个类,我不需要加载到我们项目中,需要指明type=FilterType.ASSIGNABLE_TYPE
不指定type类型执行classes={xxx...} 排除不了
它有五种类型:
public enum FilterType {
ANNOTATION,
ASSIGNABLE_TYPE,
ASPECTJ,
REGEX,
CUSTOM;
}
spring bohttp://ot 排除个别配置类的代码
废话不说,直接上代码
@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))
这段是经典~
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~