title: How to exclude a class from Spring in applicationContext?
body: <p>Here we only want to exclude a class from certain classpath, say</p>
  
  <p><code>com.abc.projectA.service.orderService.sectionA.orderService.class</code></p>
  
  <p>However there is another class with same name but in different classpath</p>
  
  <p><code>com.abc.projectA.service.orderService.sectionB.orderService.class</code></p>
  
  <p>so that only filer by class name is not going to work.</p>
  
  <p>But I tried the following method:</p>
  
  <pre><code>&lt;context:component-scan base-package="com.abc"&gt;
      &lt;!--other filters--&gt;
      &lt;!--.......--&gt;
      &lt;context:exclude-filter expression="projectA\.service\.orderService\.sectionA\.orderService" type="regex" /&gt;
  &lt;/context:component-scan&gt;
  </code></pre>
  
  <p>It doesn't work. So I bet the <code>&lt;context:exclude-filter&gt;</code> only valid on package level but not for specific class? If so, how to exclude a class from bean injection so that we can pick and choose with class to get wired with same class name?</p>
  
  <p>Thanks in advance.</p>