I am building a jar dependency that will create a bean of a type that is likely to exist already in the apps that will use that dependency.
I want to create a configuration spring class in the dependency to mark that bean as "secondary".
How can we set explicitly a bean as secondary (or @Primary(value=false) )
in spring with annotations or with java config?
There is also the autoWireCandidate
on the @Bean
annotation. But that is available only from the very young spring versions.
Asked
Active
Viewed 219 times
0

Roxana
- 1,569
- 3
- 24
- 41
-
do you mean optional bean? – Ori Marko Dec 10 '20 at 08:13
-
It will not be optional per se. it will always be created. I just want to make sure it does not mess up existing beans. – Roxana Dec 10 '20 at 09:41