-
Notifications
You must be signed in to change notification settings - Fork 38.9k
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
Marty Pitt opened SPR-11740 and commented
Currently, when declaring my beans via Java config, I'm provided with two options:
- Implicitly, without construction responsibility -- Using a
@Componentannotation, and let Spring discover the bean. - Explicitly, with construction responsibility -- Using a
@Beanannotation within a@Configurationclass.
There is a valid use case where I would like to explicitly declare a set of beans, but leave Spring responsible for their construction.
This is analogous to the classic <bean class=""> xml approach.
A possible syntax for this would be:
@Configuration
public class MyAppConfig {
// Explictly provide the class, not the instance to Spring
@Bean
public MyFunkySpringBean funkyBean; // No instance -- it's up to Spring to build
}Reference URL: http://stackoverflow.com/questions/23313262/spring-java-config-specify-class-only
Issue Links:
- @Bean on Java 8 default methods in interfaces [SPR-10919] #15547
@Beanon Java 8 default methods in interfaces
Referenced from: commits f0ac278, a15dc08
1 votes, 9 watchers
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