applicationContext-solr.xml
一、动态切换单机和集群 spring-solr 的配置
<!-- 单机版 solrj --> <bean id = "httpSolrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer"> <constructor-arg index="0" value="http://192.168.25.129:8080/solr/collection1"></constructor-arg> </bean> <!-- 集群版 solrj --> <bean id = "cloudSolrServer" class="org.apache.solr.client.solrj.impl.CloudSolrServer"> <constructor-arg index="0" value="192.168.25.129:2181,192.168.25.129:2182,192.168.25.129:2183"></constructor-arg> <property name="defaultCollection" value="collection2"></property> </bean>