title: Creating a SolrCrudRepository manually
body: <p>In reference to <a href="https://stackoverflow.com/questions/16859181/spring-data-solr-multiple-cores-and-repository">this article</a></p>
  
  <p>I want to manually set up a repository using my own <code>SolrTemplate</code>. This is because I have multiple instances of Solr running and I want a repo for each one of them. Here's what I do:</p>
  
  <p>Bean definition:</p>
  
  <pre><code>&lt;bean id="currencySolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer"&gt;
      &lt;constructor-arg value="${solr.server.currency.url}" index="0"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="currencySolrTemplate" class="org.springframework.data.solr.core.SolrTemplate"&gt;
      &lt;constructor-arg index="0" ref="currencySolrServer"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>I have a very basic repository:</p>
  
  <pre><code>@Component
  public interface CurrencyRepository extends SolrCrudRepository&lt;SolrInputDocument, String&gt;
  {
  }
  </code></pre>
  
  <p>A service class:</p>
  
  <pre><code>@Service
  public class SolrService
  {
    @Resource
    @Qualifier("currencySolrTemplate")
    SolrTemplate currencySolrTemplate;
    private CurrencyRepository repository;
  
   /*init the repo*/
    @PostConstruct
    public void init()
    {
      log.debug("Creating SolrRepository");
      repository = new SolrRepositoryFactory(currencySolrTemplate)
      .getRepository(CurrencyRepository.class);
      log.debug( "SolrRepositiory created" );
    }
  }
  </code></pre>
  
  <p>According to the referenced article, Bob's my uncle, But, instead it blows up in the <code>init()</code> method with:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CurrencyRepository': Cannot resolve reference to bean 'solrTemplate' while setting bean property 'solrOperations'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'solrTemplate' is defined
  </code></pre>
  
  <p>Right. Convention over configuration. Why is <code>CurrencyRepository</code> still looking for a reference to a default <code>SolrTemplate</code> although I have given it my own <code>currencySolrTemplate</code>?</p>