用@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})})