I want to register bean (MyBean
) only if another bean (anotherBeanThatShouldBePresent
) is present in the context.
How I can achieve that?
bean {
MyBean(
anotherBeanThatShouldBePresent = ref()
)
}
I want to register bean (MyBean
) only if another bean (anotherBeanThatShouldBePresent
) is present in the context.
How I can achieve that?
bean {
MyBean(
anotherBeanThatShouldBePresent = ref()
)
}
Copyright © 2021 Jogjafile Inc.
You can use ObjectProvider to create bean depending on another bean
With this code I will register MyCustomBean only if OtherBeanOnWhichIDepend bean is available