-
Couldn't load subscription status.
- Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Consider the following use case:
@Configuration
public class Config {
@Bean(name = "myBean")
MyBean someBean() { ... }
@Bean(name = "myBean")
MyBean someBean(MyDependency) { ... }
}The container accepts an override for myBean as long as it is in the same configuration class to mimic the resolution of the greediest satisfiable constructors for bean factory methods.
Such an arrangement is much better served using Optional or ObjectProvider with a single bean factory method as it makes it explicit that some argument may or may not be available.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement