How to autowire factorybean
java, spring
Solution
It turns out that the answer is ...
@Resource(name="services") private List services;
Problem
I have a ServiceListFactoryBean which creates a list of service implementations: ``` <bean id="services" class="org.springframework.beans...ServiceListFactoryBean" p:serviceType="ServiceInterface"/> ``` I can access the services using the applicationContext without a problem: ``` final List services = ctx.getBean("services", List.class)); ``` I can also use trad constructor-arg injection successfully: ``` <bean id="aClass" class="AClass"> <constructor-arg ref="services"/> </bean> ``` But if I try to autowire the dependency ``` @Autowired @Qualifier("services") private List services; ``` Then I get a `BeanCreationException` caused by ``` FatalBeanException: No element type declared for collection [java.util.List] ``` I am using Spring 3.0.