I would like to add another core to my Solr 5.5.0 embedded server environment. "In my world" i create an embedded server and let spring-data load the core configurations. But with my solution it seems that all data go into the default core "collection1". So far i couldn't find an example beside spring-boot. But that is not an option.
My configuration looks like this so far:
@Import({
AppctxSolrEmbedded.class,
AppctxSolrHttp.class
})
@EnableSolrRepositories(value = "de.my.application.*.repository", multicoreSupport = true)
@Configuration
public class AppctxSolr {
public @Bean SolrTemplate solrTemplate(
@Named("solrClient") SolrClient solrClient) {
return new SolrTemplate(solrClient, "collection1");
}
public @Bean SolrTemplate operatorSolrTemplate(
@Named("solrClient") SolrClient solrClient) {
return new SolrTemplate(solrClient, "operator1");
}
}
@Dev @Qual @RemoteDev
@Configuration
public class AppctxSolrEmbedded {
@Bean
public EmbeddedSolrServerFactoryBean solrClient(
@Value("${solr.server}") String solrHome) {
EmbeddedSolrServerFactoryBean factory = new EmbeddedSolrServerFactoryBean();
factory.setSolrHome(solrHome);
return factory;
}
}
@Prod
@Configuration
public class AppctxSolrHttp {
@Bean
public HttpSolrClientFactoryBean solrClient(
@Value("${solr.server}") String baseURL) {
HttpSolrClientFactoryBean factory = new HttpSolrClientFactoryBean();
factory.setUrl(baseURL);
return factory;
}
}