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
@Component annotation, and let Spring discover the bean.
- Explicitly, with construction responsibility -- Using a
@Bean annotation within a @Configuration class.
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:
Referenced from: commits f0ac278, a15dc08
1 votes, 9 watchers
Marty Pitt opened SPR-11740 and commented
Currently, when declaring my beans via Java config, I'm provided with two options:
@Componentannotation, and let Spring discover the bean.@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:
Reference URL: http://stackoverflow.com/questions/23313262/spring-java-config-specify-class-only
Issue Links:
@Beanon Java 8 default methods in interfacesReferenced from: commits f0ac278, a15dc08
1 votes, 9 watchers