【随手记录】关于 The following classes could not be excluded because they are not auto-configuration classes

用@SpringBootApplication(exclude = RibbonRule.class)排除类@bean注入的类的时候报错

The following classes could not be excluded because they are not auto-configuration classes.....

stackoverflow  和 spring 的issue 找到了答案,@SpringBootApplication的exclude  专门用来排除auto-configuration 也就是我们说的自动配置的类的,

如果我们想排除自己定义的@Bean,可以用 @ComponentScan(excludeFilters= {@ComponentScan.Filter(type=FilterType.ANNOTATION, value= {AvoidScan.class})})

posted @ 2019-04-25 18:53  空知大仙人  阅读(11729)  评论(0编辑  收藏  举报