当我们的SpringBoot引用了别的SpringBoot项目并且不能修改其中的代码 但是不想使用其中某个@Configuration配置类中配置 想但单独排除某个配置类 可以在启动类加上

@SpringBootApplication(exclude = {CommonShiroConfig.class})
@ComponentScan(excludeFilters  = {@ComponentScan.Filter(
        type = FilterType.ASSIGNABLE_TYPE, classes = {WebConfigurer.class})}, basePackages = {"com.echohawk.cloud"})

其中classes中填写要排除的类

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐