I have multiple datasource beans defined in my configuration file.I have 2 beans named customerDataSource. I want one of them to be instantiated only if other bean is not loaded.I was trying to use @ConditionalOnMissingBean. However it looks like this will work only when another bean of same "type" is not present. Is there a way to control this by using "name"?
The annotation has the parameter name, where you can specify the bean name that should be checked:
@ConditionalOnMissingBean(name = "beanNameToCheck")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With