![](/img/trans.png)
[英]Bean found in ApplicationContext, but not found when attempting to Autowire
[英]Autowire a default implementation if implemenation bean is not found
我有一個界面有2個默認方法。 如果找不到實現,我希望使用這兩種默認方法自動裝配代理bean。 這可能在春天嗎?
您需要在某些配置中定義bean
@Bean
@ConditionalOnMissingBean
public Foo foo(){
return new Foo() {};
}
Foo
是你的界面。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.