title: @ComponentScan with multiple configuration class : Annotation Based Configuration
body: <p>As per Spring Doc-</p>
  
  <blockquote>
    <p>Configures component scanning directives for use with @Configuration classes. Provides support parallel with Spring XML's <code>&lt;context:component-scan&gt;</code> element.</p>
  </blockquote>
  
  <p>In my spring web application there are multiple files those are marked <code>@Configuration</code>,in order to register <code>@component</code> bean in spring container-</p>
  
  <p><strong>Question1-</strong> Can we use <code>@ComponentScan</code>  <strong>in any</strong> of the <code>@Configuration</code> class  <strong>or in all</strong> <code>@Configuration</code> classes?</p>
  
  <p><strong>Question2-</strong></p>
  
  <p>Also I seen in spring <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/config/annotation/EnableWebMvc.html" rel="noreferrer">doc</a> </p>
  
  <pre><code>@Configuration
  @ComponentScan(basePackageClasses = { MyConfiguration.class })
  public class MyConfiguration extends WebMvcConfigurerAdapter {
  ...
  }
  </code></pre>
  
  <p>Why here scanning for configuration class itself.</p>
  
  <p>edit: Basically my understanding with <code>@ComponentScan</code> is to scan and register stereo type bean(ex- <code>@componant</code>,<code>@Controller</code>,<code>@Services</code> etc..),why we are registering <code>@Configuration</code> Bean.</p>