如何在spring-data-solr中连接多个连接服务器solr

问题描述

连接服务器 solr 1

@配置 @EnableSolrRepositories(basePackages={"foo.utilities.solr.repos.gcr"},multicoreSupport=true) 公共类 GcrSolrContext {

@Bean
public SolrClient solrClient() {
    return new HttpSolrClient("http://foo:8086/solr/gcr");
}

@Bean
public SolrTemplate solrTemplate(SolrClient client) throws Exception {
    return new SolrTemplate(client);
}

}

连接服务器 solr 2

@Configuration
@EnableSolrRepositories(basePackages={"foo.utilities.solr.repos.different"},multicoreSupport=true)
public class DifferentSolrContext {

    @Bean
    public SolrClient solrClient() {
        return new HttpSolrClient("http://SomethingDifferent:8086/solr/something");
    }

    @Bean
    public SolrTemplate solrTemplate(SolrClient client) throws Exception {
        return new SolrTemplate(client);
    }
}

错误:服务器 sorl 1 覆盖了服务器 solr 2

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)