Oliver Drotbohm opened SPR-11419 and commented
In JavaConfig you can currently use an @Autowired(required = false) List<MyComponent> myComponents field to access all beans of a given type to potentially hand them into a component manually instantiated in an @Bean method.
That said, it would be nice if this pattern could be used at the @Bean method level directly such as:
@Bean public MyOtherComponent foo(List<MyComponent> myComponents) {
…
}
This currently throws an exception if not bean of type MyComponent can be found but could just fall back to an empty list, which is what you get with the field based approach currently.
Affects: 4.0.1
Issue Links:
0 votes, 5 watchers
Oliver Drotbohm opened SPR-11419 and commented
In JavaConfig you can currently use an
@Autowired(required = false) List<MyComponent> myComponentsfield to access all beans of a given type to potentially hand them into a component manually instantiated in an@Beanmethod.That said, it would be nice if this pattern could be used at the
@Beanmethod level directly such as:This currently throws an exception if not bean of type
MyComponentcan be found but could just fall back to an empty list, which is what you get with the field based approach currently.Affects: 4.0.1
Issue Links:
0 votes, 5 watchers