Spring 使用 solrj 但不是 spring-boot-starter-data-solr 时启动会崩溃

Spring Boot blows up when using solrj but not spring-boot-starter-data-solr

我正在尝试将现有的 Spring 应用程序移植到 Spring Boot。我 NOT 使用 spring-boot-starter-data-solr 启动器但是我的类路径上有 apache solrj (5.0.0)。

在启动过程中,应用程序崩溃了。似乎 spring boot 看到了 solr 类 并假设我在类路径上也有 spring-boot-starter-data-solr。特别是我收到此错误:

java.lang.IllegalArgumentException: @ConditionalOnMissingBean annotations must specify at least one bean (type, name or annotation)

如果我放弃 solrj 依赖项并改用 spring-boot-starter-data-solr 就可以了。但是我不需要 spring-data-solr 集成,这样做会迫使我将我们的应用程序向后移植到 4.7.x 版本的 solr。

有人知道解决这个问题的方法吗?

所以问题似乎是由 spring 引导对 solrj 4.7.x 的依赖引起的,而我使用的是 5.0.0

我用

修复了它
@SpringBootApplication(exclude = {SolrAutoConfiguration.class})

告诉启动完全忽略 SolrAutoConfiguration。