【隨手記錄】關於 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