title: Java Spring how to set up multicore Solr configuration
body: <p>Basically I copy pasted the multicore configuration from <a href="http://docs.spring.io/spring-data/solr/docs/1.0.x/reference/html/solr.repositories.html" rel="nofollow">http://docs.spring.io/spring-data/solr/docs/1.0.x/reference/html/solr.repositories.html</a> and then adjusted a bit, however it does not work, because I need to add corename-SolrClient to the ClientFactory. But do I just create the SolrCLient out of the blue? I want it all to match the cores that are running on the server on my machine. This is the configuration class for the solr:</p>
  
  <pre><code>private static final String PROPERTY_NAME_SOLR_SERVER_URL = "solr.host";
  
  
        @Resource
        private Environment environment;
  
        @Bean
        public SolrClientFactory solrClientFactory() {
            MulticoreSolrClientFactory factory =  new MulticoreSolrClientFactory(
                    new HttpSolrClient(environment.getRequiredProperty(
                            PROPERTY_NAME_SOLR_SERVER_URL) ));
            return factory;
        }
  
        @Bean (name = "SolrTemplateMap")
        public Map&lt;Language, SolrTemplate&gt; solrTemplateList(){
            HashMap&lt;Language, SolrTemplate&gt; map = new HashMap&lt;&gt;();
            for (Language l : Language.values()){
                SolrTemplate template = new SolrTemplate (solrClientFactory());
                template.setSolrCore(l.toString());
                map.put( l, template);
            }
            return map;
        }
  </code></pre>
  
  <p>I tried adding </p>
  
  <pre><code>for (Language l : Language.values()){
                factory.addSolrClientForCore(new HttpSolrClient(url + "/solr/" + l.toString()), l.toString());
            }
  </code></pre>
  
  <p>in the factory bean, however it doesn't solve anything. <code>Language</code> is an enum.</p>