Env - JBoss 5.1, Spring 3.1.2, jdk 1.5
I am trying to autowire a list. As per the discussion here Auto-wiring a List using util schema gives NoSuchBeanDefinitionException, @Resource doesn't work with JBoss.
<util:list id="reportTypes">
<value>PDF</value>
<value>CSV</value>
<value>XML</value>
</util:list>
@Inject
private List<String> reportTypes;
I also tried using @Inject, but I get the same exception. What am I missing ?
I am using the JSR 330, com.springsource.javax.inject-0.9.0.PFD.jar file for @Inject as mentioned here http://forum.springsource.org/showthread.php?78737-JSR-330-Inject-Spring-3-0
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [java.lang.String] found for dependency
[collection of java.lang.String]: expected at least 1 bean which qualifies as autowire
candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}
EDIT using
@Resource(name = "reportTypes")
private List<String> reportTypes;
throws
java.lang.RuntimeException: mapped-name is required for reportTypes of deployment app.war
at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXmlResourceEnvRefs(WebResourceHandler.java:287)
at org.jboss.web.tomcat.service.injection.WebResourceHandler.loadXml(WebResourceHandler.java:325)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.processMetadata(TomcatInjectionContainer.java:550)
at org.jboss.web.tomcat.service.WebCtxLoader.start(WebCtxLoader.java:158)