title: wildcards in base-package attribute in Spring component scanning
body: <p>Can somebody explain what does the ** stand for in context of spring configuration?</p>
  
  <pre><code>&lt;context:component-scan base-package="a.b.**" /&gt;
  </code></pre>
  
  <p>and how does that differ from </p>
  
  <pre><code>&lt;context:component-scan base-package="a.b" /&gt;
  </code></pre>
  
  <p>I couldn't find anything about using wildcards/ant style paths in the base-package attribute of the component-scan element.</p>
  
  <p>Could you also point me to any documentation/source code that would explain using
  wildcards in the component-scanning attribute? My google-fu is of no use</p>
  
  <p><strong>EDIT:</strong>
  I did some more experiments based on the accepted answer, it all makes sense now knowing how the value of base-package attribute is 'converted' to resource string.</p>
  
  <p>So, I created two Spring managed components</p>
  
  <pre><code>a.b.SpringBean2
  a.b.c.d.SpringBean1
  </code></pre>
  
  <p>SpringBean1 has SpringBean2 injected using @Autowired </p>
  
  <p>so not only this:</p>
  
  <pre><code>&lt;context:component-scan base-package="a.b"/&gt;
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>&lt;context:component-scan base-package="a.b.**"/&gt;
  </code></pre>
  
  <p>work OK in the sense that SpringBean2 can be resolved correctly to be injected in SpringBean1, but these will also work:</p>
  
  <pre><code>&lt;context:component-scan base-package="a.b.**.**.**"/&gt; &lt;!-- as many .** as you want--&gt;
  &lt;context:component-scan base-package="a.b**"/&gt;
  &lt;context:component-scan base-package="a.b*"/&gt;
  </code></pre>
  
  <p>This however will fail with NoSuchBeanDefinitionException because of unresolved SpringBean2 type:</p>
  
  <pre><code>&lt;context:component-scan base-package="a.b.*"/&gt;
  </code></pre>