title: Spring Qualifier, service implementation when application starts
body: <p>(spring version is 4.1.6)
  I have a service Interface "<em>ContractService</em>" that retreives contracts of a person.
  2 service classes <strong>ContratServiceImpl</strong> &amp; <strong>ContratServiceImplWeb</strong> implementing this interface.
  <strong>ContratServiceImpl</strong> calls dao to retreive data
  <strong>ContratServiceImplWeb</strong>  calls web service...</p>
  
  <p>The Interface <em>ContractService</em> is used by another service (UTService): </p>
  
  <pre><code> @org.springframework.stereotype.Service
      @Transactional(value="transactionManager")
      public class UTServiceImpl implements UTService {
  
          @Autowired @Qualifier(...&lt;variable.propeties&gt;...)
          private ContractService contractService;
     ...
  }
  </code></pre>
  
  <p>Here are services implementing the interface that can be in</p>
  
  <pre><code>@Service("ContratServiceImplWeb") @Transactional(value="transactionManager")
  class ContratServiceImplWeb implements ContratService {
  ...
  }
  
  @Service("ContratServiceImpl") @Transactional(value="transactionManager")
  class ContratServiceImpl implements ContratService {
  ...
  }
  
  Configuration class
  @Configuration
  @EnableTransactionManagement
  @ImportResource(value={ "classpath:sessionFactory-datasource-spring.xml", "classpath:contrat_factories.xml"} )
  @ComponentScan(basePackages = { "com.xxx.core.service.impl"
                                , "com.xxx.core.dao.impl"}
  )
  public class ContextCoreServiceConfiguration {
  
  }
  </code></pre>
  
  <p>When my application starts I would like to "qualify" ContractService with ContratServiceImpl  or ContratServiceImplWeb  depending an external configuration file (.properties or XML) where bean names are set.</p>
  
  <p>How can I do this ?</p>
  
  <p>----- Last comments -------
  contractServiceImpl &amp; contractServiceImplWeb are set as @service and scanned  by configuration. </p>
  
  <p>In "UTServiceImple" class, 1 of the 2 classes need to be @autowired with a discriminating parameter (may Profile ?). This is not the only group of classes that is concerned. </p>
  
  <p>Profile should not be the same from a couple to another. 
  So, I have to set a profile for each group of classes ? </p>