title: How to config @ComponentScan dynamic?
body: <pre><code>@ComponentScan(  //CS1
      basePackages = {"com.package.A", "com.package.B"},
      excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
                                             value = {com.Package.A.SomeClass.class
                                             })
  )
  
  @ComponentScan(  //CS2
      basePackages = { "com.package.A"}
  )
  @EnableAutoConfiguration
  @SpringBootApplication
  public class Application {
    public static void main(String[] args) throws Exception {
      ConfigurableApplicationContext ctx = SpringApplication.run(Application.class, args);
    }
  }
  </code></pre>
  
  <p>Above is my <code>SpringBootApplication</code>'s main class.<strong><em>As you can see,I have to use Annnotation ,not xml</em></strong>. There are two <code>@ComponentScan</code> Annotations.And it is not permitted for Spring, of course. For me, the two different <code>@ComponentScan</code> means two different way to start up my application. And if I choose to use CS1(it means @ComponentScan1), I hava to comment CS2，and vice versa.</p>
  
  <p>It's not elegant or graceful.Especially for those who are newbie for Spring.<strong><em>So I wonder know how can I config it dynamic according to my .properties file</em></strong>.Such as a param in my .properties file called "isScanA" is ture, then I can use CS1. Or any  other elegant way.</p>
  
  <p>I have tried a lot.</p>
  
  <ol>
  <li><p>Use placeholder. Such as <code>@ComponentScan(basePackage="${scan.basePackage}")</code> .And change the value in .properties file when needed. But this way can't fix the <code>excludeFilters</code>. Because if I use <code>FilterType.ASSIGNABLE_TYPE</code> to assign the class which need to be exclude, the <code>value</code> should be a <code>Class</code> type not a <code>String</code>,where if <code>value = {"${scan.excludeClass}"}</code> be used.</p></li>
  <li><p>Programmatic way.</p>
  
  <pre><code>/**
   * Create a new AnnotationConfigApplicationContext, scanning for bean definitions
   * in the given packages and automatically refreshing the context.
   * @param basePackages the packages to check for annotated classes
   */
  public AnnotationConfigApplicationContext(String... basePackages) {
      this();
      scan(basePackages);
      refresh();
  }
  </code></pre></li>
  </ol>
  
  <p>I called this method in  my main function.But it also can't fix the <code>excludeFilters</code> problem, the reason is here:<a href="https://stackoverflow.com/questions/5575470/doing-contextcomponent-scan-programatic-way">Doing context:component-scan programatic way?</a></p>
  
  <p>...</p>
  
  <p>I really tried a lot , but still can't fix. So I need your help. </p>
  
  <p>Forgive my poor English, plz.</p>
  
  <p>Thanx a lot, at least you have take a little time to read.</p>