diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientAutoConfiguration.java
index ea68b2624d..1f99a2b859 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientAutoConfiguration.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/rest/RestClientAutoConfiguration.java
@@ -62,12 +62,13 @@ public class RestClientAutoConfiguration {
@Bean(destroyMethod = "close")
@ConditionalOnMissingBean
- public RestClient restClient() {
- RestClientBuilder builder = configureBuilder();
+ public RestClient restClient(RestClientBuilder builder) {
return builder.build();
}
- protected RestClientBuilder configureBuilder() {
+ @Bean
+ @ConditionalOnMissingBean
+ public RestClientBuilder restClientBuilder() {
HttpHost[] hosts = this.properties.getUris().stream().map(HttpHost::create)
.toArray(HttpHost[]::new);
RestClientBuilder builder = RestClient.builder(hosts);
@@ -90,8 +91,9 @@ public class RestClientAutoConfiguration {
@Bean
@ConditionalOnMissingBean
- public RestHighLevelClient restHighLevelClient(RestClient restClient) {
- return new RestHighLevelClient(restClient);
+ public RestHighLevelClient restHighLevelClient(
+ RestClientBuilder restClientBuilder) {
+ return new RestHighLevelClient(restClientBuilder);
}
}
diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml
index 62eca1edba..0998baf4da 100644
--- a/spring-boot-project/spring-boot-dependencies/pom.xml
+++ b/spring-boot-project/spring-boot-dependencies/pom.xml
@@ -59,7 +59,7 @@
2.0.3
5.0.7
2.3.28
- 5.6.9
+ 6.2.4
3.0.0
2.4.15
2.8.4