-
Notifications
You must be signed in to change notification settings - 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
Sometimes, one wants to be able to register a bean of a given type without breaking existing code, especially in multi-module projects. Assuming that a bean is already available:
@Bean
public SomeType someTypeBean() {
return new SomeType();
}
and used as in:
@Bean
public SomeOtherType someOtherTypeBean(SomeType val) {
return new SomeOtherType(val);
}
I would like to being able to register a bean:
@Bean
@Secondary // mirrored behavior of @Primary
public SomeType someNewTypeBean() {
return new SomeType();
}
without disturbing existing code. If the someTypeBean is missing, it should fallback to someNewTypeBean, this would also allow for much smoother migrations in the case of multiple profiles.
BohdanM-AVISPL, bartoszpop, JoshMcCullough, kycrow32, IncPlusPlus and 17 morekventil, mvucenovic, reda-alaoui, Tristan971, helpermethod and 28 more
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