[英]Migration netflix feign in Springboot 1.x to openfeign in Springboot 2.x
[英]Combine springBoot with elasticsearch 2.x
我尝试使用spring boot 1.3.3来实现与elasticsearch进行通信的项目。 在网上进行了多次搜索之后,我发现spring-boot-starter-data-elasticsearch在我的情况下并不好,因为它使用Elasticsearch 1.5并且我必须使用Elasticsearch 2.2仍然有希望使用spring boot?
当然,您可以将Spring Boot与Elasticsearch 2.x一起使用。 我正在使用它。 这是我的gradle.build的摘录。
apply plugin: 'spring-boot'
buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
}
}
dependencies {
// Elasticsearch
compile ("org.elasticsearch:elasticsearch:2.1.1")
// Spring Boot
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-web")
...
}
...
如果它不适合您的需要,请不要使用spring-boot-starter-data-elasticsearch。
如果需要,可以在使用最新版本更新spring-boot-starter后返回并更新依赖项。 对于Elasticsearch 2.2.0版本,目前有一个2.0.0.RC1版本的spring-data-elasticsearch,因此可以合理地假设spring-boot-starter也会很快更新。
希望这可以帮助。
只有spring-data-elasticsearch子项目与Elasticsearch相关联。 顺便说一句,恕我直言,这种集成真的很糟糕,因为他们试图将非常灵活的Elasticsearch API适用于非常有限的接口。 如果你想将Spring Boot用于微服务基础设施和其他东西,只需将它与适当版本的elasticsearch客户端一起使用,不要打扰spring-boot-starter-data-elasticsearch。
我们使用https://github.com/searchbox-io/Jest成功使用Spring Boot。 以前我们尝试使用spring-data-elasticsearch但是它与sping-data-mongodb一起使用起来并不好用。 然后我们搬到了JEST,再也没有回头。
只需添加
compile('io.searchbox:jest:2.0.2')
gradle配置文件。 JEST有大量的测试,您可以在其中找到所有可能的用例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.