【随手记录】关于 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})})


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM