Skip to content

Make spring support like CDI @Produces (for Array/Map/Collection inject) [SPR-11269] #15894

Closed
@spring-projects-issues

Description

@spring-projects-issues

zhangkaitao opened SPR-11269 and commented

cdi support like

 
@Produces
List<Conference> availableConfs;

see http://my.oschina.net/hantsy/blog/186939

because spring implement array/collection/map inject use find Component bean then add to array/collection/map。Can simple modify DefaultListableBeanFactory to support。please see 864 line:
https://github.com/zhangkaitao/spring4-showcase/blob/master/spring4-others/src/test/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

1、find like List<BeanInterface> bean;
2、find BeanInterface bean,add to List;
3、others;

example:
https://github.com/zhangkaitao/spring4-showcase/blob/master/spring4-others/src/test/java/com/sishuok/spring4/genericinject/GenericInjectTest.java

only support java config way,if want support xml,need modify bean definition(add ResolvableType else collection class)


Affects: 4.0 GA

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions