Gracefully disable Solr auto-configuration when Solr 5 is on classpath
Previously, if Solr 5 was on the classpath, SolrAutoConfiguration would fail with a rather cryptic error message due to a change in the inheritance hierarchy of CloudSolrServer between Solr 4 and Solr 5. This commit updates SolrAutoConfiguration to be conditional on a class that exists in Solr 4 but was removed in Solr 5. This has the effect of switching off the auto-configuration when Solr 5 is on the classpath, allowing the auto-configuration report to be used to identify why the configuration was disabled. The documentation has also been updated to state that Spring Boot does not currently support Solr 5.0. Closes gh-2795
This commit is contained in:
@@ -21,6 +21,7 @@ import javax.annotation.PreDestroy;
|
||||
import org.apache.solr.client.solrj.SolrServer;
|
||||
import org.apache.solr.client.solrj.impl.CloudSolrServer;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
||||
import org.apache.solr.common.cloud.HashPartitioner;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -31,13 +32,14 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Solr.
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Solr 4.x.
|
||||
*
|
||||
* @author Christoph Strobl
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ HttpSolrServer.class, CloudSolrServer.class })
|
||||
@ConditionalOnClass({ HttpSolrServer.class, CloudSolrServer.class,
|
||||
HashPartitioner.class })
|
||||
@EnableConfigurationProperties(SolrProperties.class)
|
||||
public class SolrAutoConfiguration {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user