title: Spring 3.0.x - context:component-scan result into list
body: <p>I am wondering if there is a possibility to put spring beans from a component scan into a list to inject the list to a property?</p>
  
  <p>I am using Spring 3.0.x and Java 6 (1.6).</p>
  
  <p>What I have tried so far is the following:</p>
  
  <pre><code>&lt;util:list id="converterList"&gt;
      &lt;context:component-scan base-package="com.company.convert"/&gt;
  &lt;/util:list&gt;
  &lt;!-- configure custom b2bde converters --&gt;
  &lt;bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean"&gt;
      &lt;property name="converters"&gt;
          &lt;list&gt;
              &lt;ref local="converterList"/&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>But I get following exception:</p>
  
  <pre><code>SEVERE: Exception sending context initialized event to listener instance of class de.hybris.platform.spring.HybrisContextLoaderListener
  org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Incorrect usage of element 'context:component-scan' in a nested
   manner. This tag cannot be used nested inside &lt;property&gt;.
  Offending resource: ServletContext resource [/WEB-INF/my-servlet.xml]
  
          at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
          at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
          at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:284)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseNestedCustomElement(BeanDefinitionParserDelegate.java:1390)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertySubElement(BeanDefinitionParserDelegate.java:956)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCollectionElements(BeanDefinitionParserDelegate.java:1140)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseListElement(BeanDefinitionParserDelegate.java:1116)
          at org.springframework.beans.factory.xml.UtilNamespaceHandler$ListBeanDefinitionParser.doParse(UtilNamespaceHandler.java:123)
          at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
          at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
          at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
          at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
          at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
          at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
          at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
          at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
          at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
          at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
          at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
  </code></pre>
  
  <p>Do I missing a point or is it not really possible to scan beans, put them into a list and use this list in a property?</p>
  
  <p>Best Regards,
  Walter</p>