title: Dependency injection with Spring not working when using nested beans
body: <p>I'm trying to use Spring and have a trouble using it for a case.
  I have the following code:</p>
  
  <pre><code>&lt;util:map id="someMap" value-type="java.util.Set"&gt;
      &lt;entry key="a" value-ref="setA"/&gt;
      &lt;entry key="b" value-ref="setB"/&gt;
  &lt;/util:map&gt;
  
  &lt;util:set id="setA"&gt;
      &lt;value&gt;A&lt;/value&gt;
  &lt;/util:set&gt;
  
  &lt;util:set id="setB"&gt;
      &lt;value&gt;B&lt;/value&gt;
  &lt;/util:set&gt;
  </code></pre>
  
  <p>with the following Java code (using @Qualifier to get "someMap"):</p>
  
  <pre><code>package a.b.c;
  public class SomeClass {
      private final Map&lt;String, Set&lt;String&gt;&gt; someMap;
      @Autowired
      public SomeClass(@Qualifier("someMap") final Map&lt;String, Set&lt;String&gt;&gt; someMap) {
          this.someMap = someMap;
      }
  }
  </code></pre>
  
  <p>and it's giving me the following error:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'a.b.c.SomeClass': Unsatisfied dependency expressed through constructor argument with index 2 of type [java.util.Map]: : No matching bean of type [java.util.Set] found for dependency [map with value type java.util.Set]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations:{@org.springframework.beans.factory.annotation.Qualifier(value=someMap)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [java.util.Set] found for dependency [map with value type java.util.Set]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=someMap)}</p>
  </blockquote>
  
  <p>Looks like it's having trouble finding the Set but I don't know why it's happening. How would you solve this problem?</p>