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:
parent
97c8749528
commit
4968900b1d
|
@ -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 {
|
||||
|
||||
|
|
|
@ -2705,11 +2705,14 @@ https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java
|
|||
[[boot-features-solr]]
|
||||
=== Solr
|
||||
http://lucene.apache.org/solr/[Apache Solr] is a search engine. Spring Boot offers basic
|
||||
auto-configuration for the Solr client library and abstractions on top of it provided by
|
||||
auto-configuration for the Solr 4 client library and abstractions on top of it provided by
|
||||
https://github.com/spring-projects/spring-data-solr[Spring Data Solr]. There is
|
||||
a `spring-boot-starter-data-solr` '`Starter POM`' for collecting the dependencies in a
|
||||
convenient way.
|
||||
|
||||
TIP: Solr 5 is currently not supported and the auto-configuration will not be enabled by
|
||||
a Solr 5 dependency.
|
||||
|
||||
|
||||
|
||||
[[boot-features-connecting-to-solr]]
|
||||
|
|
Loading…
Reference in New Issue