title: How Spring select Service Implementation?
body: <p>I have two projects in eclipse <code>siteBase</code> and <code>siteCustom</code></p>
  <p>siteBase have controller</p>
  <pre><code>public final class BaseController{
    
      @Autowired
      BaseService service;
    
      @POST
      @Path(/test)
      public final boolean test() {
        try {
          service.test();
        }
        catch (Throwable ex) {
          processException(ex);
        }
        return true;
      }
    }
  </code></pre>
  <p>A BaseService Interface</p>
  <pre><code>public interface BaseService extends BasicService{
  
      boolean test();
  
    }
  </code></pre>
  <p>And a BaseService Implementation</p>
  <pre><code>    public class BaseServiceImpl implements BaseService {
  
      public boolean test() {
          System.out.println(&quot;BaseServiceImpl&quot;);
          return true;
        }
      }
  </code></pre>
  <p>And in the siteCustom I have a other Implementation</p>
  <p>public class BaseServiceCustomImpl implements BaseService {</p>
  <pre><code>public boolean test() {
      System.out.println(&quot;BaseServiceCustomImpl&quot;);
      return true;
    }
  }
  </code></pre>
  <p>As I expect, when I <code>run siteBase</code> and call test controller have a console print:</p>
  <blockquote>
  <p>BaseServiceImpl</p>
  </blockquote>
  <p>And if I <code>run siteCustom</code> and call test controller have a console print:</p>
  <blockquote>
  <p>BaseServiceCustomImpl</p>
  </blockquote>
  <p>(I hope the code it's ok, but it's not problem, it's only for example purpose and It's not tested, it's only to explain the situation)</p>
  <p>The other day, suddenly, when I <code>run siteCustom</code> the console show BaseServiceImpl... after some update it again works ok the console shows BaseServiceCustomImpl, but I want to understand exactly how Spring uses the Implementation and when and where decide which Implementation and its methods use.</p>