You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
An ObjectFactory variant with lenient not-unique handling [SPR-13943] #18515
In Spring Boot it is very common to associate a bean to something if it is found in the context. If there is more than one instance but one is flagged as primary then we're fine as well. If there are more than one instance and the user did not mark a preference for one, then we don't know which one to use.
We would need a first class support of that use case, maybe based on the ObjectFactory. Something that would return the candidate bean or null if none was found.
I've introduced a SmartObjectFactory sub-interface with getIfAvailable() and getIfUnique() variants, allowing for programmatic optionality and lenient not-unique handling.
Activity
spring-projects-issues commentedon Feb 12, 2016
Juergen Hoeller commented
I've introduced a
SmartObjectFactorysub-interface withgetIfAvailable()andgetIfUnique()variants, allowing for programmatic optionality and lenient not-unique handling.Juergen
spring-projects-issues commentedon Feb 23, 2016
Juergen Hoeller commented
Renamed to
ObjectProvider(extendsObjectFactory), as per our discussion today.