Upgrade to Spring Data Elasticsearch 7.16.0
Closes gh-28987
This commit is contained in:
@@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure.elasticsearch;
|
||||
import java.util.Map;
|
||||
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
|
||||
@@ -41,17 +40,19 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Artsiom Yudovin
|
||||
* @since 2.1.1
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(RestHighLevelClient.class)
|
||||
@ConditionalOnBean(RestHighLevelClient.class)
|
||||
@ConditionalOnClass(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
@ConditionalOnBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
@ConditionalOnEnabledHealthIndicator("elasticsearch")
|
||||
@AutoConfigureAfter(ElasticsearchRestClientAutoConfiguration.class)
|
||||
public class ElasticSearchRestHealthContributorAutoConfiguration
|
||||
extends CompositeHealthContributorConfiguration<ElasticsearchRestHealthIndicator, RestHighLevelClient> {
|
||||
public class ElasticSearchRestHealthContributorAutoConfiguration extends
|
||||
CompositeHealthContributorConfiguration<ElasticsearchRestHealthIndicator, org.elasticsearch.client.RestHighLevelClient> {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = { "elasticsearchHealthIndicator", "elasticsearchHealthContributor" })
|
||||
public HealthContributor elasticsearchHealthContributor(Map<String, RestHighLevelClient> clients) {
|
||||
public HealthContributor elasticsearchHealthContributor(
|
||||
Map<String, org.elasticsearch.client.RestHighLevelClient> clients) {
|
||||
return createContributor(clients);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.apache.http.StatusLine;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
|
||||
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
@@ -50,7 +49,8 @@ public class ElasticsearchRestHealthIndicator extends AbstractHealthIndicator {
|
||||
|
||||
private final JsonParser jsonParser;
|
||||
|
||||
public ElasticsearchRestHealthIndicator(RestHighLevelClient client) {
|
||||
@SuppressWarnings("deprecation")
|
||||
public ElasticsearchRestHealthIndicator(org.elasticsearch.client.RestHighLevelClient client) {
|
||||
this(client.getLowLevelClient());
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.data.elasticsearch;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
@@ -83,14 +82,16 @@ abstract class ElasticsearchDataConfiguration {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(RestHighLevelClient.class)
|
||||
@ConditionalOnClass(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
static class RestClientConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(value = ElasticsearchOperations.class, name = "elasticsearchTemplate")
|
||||
@ConditionalOnBean(RestHighLevelClient.class)
|
||||
ElasticsearchRestTemplate elasticsearchTemplate(RestHighLevelClient client, ElasticsearchConverter converter) {
|
||||
@ConditionalOnBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
ElasticsearchRestTemplate elasticsearchTemplate(org.elasticsearch.client.RestHighLevelClient client,
|
||||
ElasticsearchConverter converter) {
|
||||
return new ElasticsearchRestTemplate(client, converter);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ public class ReactiveElasticsearchRestClientAutoConfiguration {
|
||||
return Credentials.from(this.deprecatedProperties);
|
||||
}
|
||||
Credentials propertyCredentials = Credentials.from(this.properties);
|
||||
Credentials uriCredentials = Credentials.from(this.properties.getUris());
|
||||
Credentials uriCredentials = Credentials.from(this.uris);
|
||||
if (uriCredentials == null) {
|
||||
return propertyCredentials;
|
||||
}
|
||||
@@ -190,9 +190,8 @@ public class ReactiveElasticsearchRestClientAutoConfiguration {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
private static Credentials from(List<String> uris) {
|
||||
Set<String> userInfos = uris.stream().map(URI::create).map(URI::getUserInfo)
|
||||
.collect(Collectors.toSet());
|
||||
private static Credentials from(List<URI> uris) {
|
||||
Set<String> userInfos = uris.stream().map(URI::getUserInfo).collect(Collectors.toSet());
|
||||
Assert.isTrue(userInfos.size() == 1, "Configured Elasticsearch URIs have varying user infos");
|
||||
String userInfo = userInfos.iterator().next();
|
||||
if (userInfo == null) {
|
||||
|
||||
@@ -30,7 +30,6 @@ import org.apache.http.impl.client.BasicCredentialsProvider;
|
||||
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestClientBuilder;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.sniff.Sniffer;
|
||||
import org.elasticsearch.client.sniff.SnifferBuilder;
|
||||
|
||||
@@ -111,27 +110,30 @@ class ElasticsearchRestClientConfigurations {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(RestHighLevelClient.class)
|
||||
@ConditionalOnMissingBean({ RestHighLevelClient.class, RestClient.class })
|
||||
@ConditionalOnClass(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
@ConditionalOnMissingBean({ org.elasticsearch.client.RestHighLevelClient.class, RestClient.class })
|
||||
static class RestHighLevelClientConfiguration {
|
||||
|
||||
@Bean
|
||||
RestHighLevelClient elasticsearchRestHighLevelClient(RestClientBuilder restClientBuilder) {
|
||||
return new RestHighLevelClient(restClientBuilder);
|
||||
org.elasticsearch.client.RestHighLevelClient elasticsearchRestHighLevelClient(
|
||||
RestClientBuilder restClientBuilder) {
|
||||
return new org.elasticsearch.client.RestHighLevelClient(restClientBuilder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(Sniffer.class)
|
||||
@ConditionalOnSingleCandidate(RestHighLevelClient.class)
|
||||
@ConditionalOnSingleCandidate(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
static class RestClientSnifferConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@SuppressWarnings("deprecation")
|
||||
Sniffer elasticsearchSniffer(RestHighLevelClient client, ElasticsearchRestClientProperties properties,
|
||||
Sniffer elasticsearchSniffer(org.elasticsearch.client.RestHighLevelClient client,
|
||||
ElasticsearchRestClientProperties properties,
|
||||
DeprecatedElasticsearchRestClientProperties deprecatedProperties) {
|
||||
SnifferBuilder builder = Sniffer.builder(client.getLowLevelClient());
|
||||
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
|
||||
|
||||
@@ -19,13 +19,12 @@ package org.springframework.boot.autoconfigure.elasticsearch;
|
||||
import java.time.Duration;
|
||||
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* Configuration properties specific to Elasticsearch's {@link RestClient} and
|
||||
* {@link RestHighLevelClient}.
|
||||
* {@link org.elasticsearch.client.RestHighLevelClient}.
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @since 2.1.0
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.util.Map;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.testcontainers.elasticsearch.ElasticsearchContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
@@ -53,12 +52,14 @@ class ElasticsearchRestClientAutoConfigurationIntegrationTests {
|
||||
.withConfiguration(AutoConfigurations.of(ElasticsearchRestClientAutoConfiguration.class));
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
void restClientCanQueryElasticsearchNode() {
|
||||
this.contextRunner
|
||||
.withPropertyValues("spring.elasticsearch.uris=" + elasticsearch.getHttpHostAddress(),
|
||||
"spring.elasticsearch.connection-timeout=120s", "spring.elasticsearch.socket-timeout=120s")
|
||||
.run((context) -> {
|
||||
RestHighLevelClient client = context.getBean(RestHighLevelClient.class);
|
||||
org.elasticsearch.client.RestHighLevelClient client = context
|
||||
.getBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
Map<String, String> source = new HashMap<>();
|
||||
source.put("a", "alpha");
|
||||
source.put("b", "bravo");
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.assertj.core.api.InstanceOfAssertFactories;
|
||||
import org.elasticsearch.client.Node;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestClientBuilder;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.client.sniff.Sniffer;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -57,6 +56,7 @@ import static org.mockito.Mockito.verifyNoInteractions;
|
||||
* @author Evgeniy Cheban
|
||||
* @author Filip Hrisafov
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
class ElasticsearchRestClientAutoConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
@@ -65,34 +65,39 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void configureShouldOnlyCreateHighLevelRestClient() {
|
||||
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(RestClient.class)
|
||||
.hasSingleBean(RestClientBuilder.class).hasSingleBean(RestHighLevelClient.class));
|
||||
.hasSingleBean(RestClientBuilder.class)
|
||||
.hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
void configureWithoutRestHighLevelClientShouldOnlyCreateRestClientBuilder() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(RestHighLevelClient.class))
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader(org.elasticsearch.client.RestHighLevelClient.class))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RestClient.class)
|
||||
.doesNotHaveBean(RestHighLevelClient.class).hasSingleBean(RestClientBuilder.class));
|
||||
.doesNotHaveBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
.hasSingleBean(RestClientBuilder.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void configureWhenCustomRestClientShouldBackOff() {
|
||||
this.contextRunner.withUserConfiguration(CustomRestClientConfiguration.class)
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(RestHighLevelClient.class)
|
||||
.run((context) -> assertThat(context)
|
||||
.doesNotHaveBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
.hasSingleBean(RestClientBuilder.class).hasSingleBean(RestClient.class)
|
||||
.hasBean("customRestClient"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void configureWhenCustomRestHighLevelClientShouldBackOff() {
|
||||
this.contextRunner.withUserConfiguration(CustomRestHighLevelClientConfiguration.class)
|
||||
.run((context) -> assertThat(context).hasSingleBean(RestHighLevelClient.class));
|
||||
this.contextRunner.withUserConfiguration(CustomRestHighLevelClientConfiguration.class).run(
|
||||
(context) -> assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void configureWhenDefaultRestClientShouldCreateWhenNoUniqueRestHighLevelClient() {
|
||||
this.contextRunner.withUserConfiguration(TwoCustomRestHighLevelClientConfiguration.class).run((context) -> {
|
||||
Map<String, RestHighLevelClient> restHighLevelClients = context.getBeansOfType(RestHighLevelClient.class);
|
||||
Map<String, org.elasticsearch.client.RestHighLevelClient> restHighLevelClients = context
|
||||
.getBeansOfType(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
assertThat(restHighLevelClients).hasSize(2);
|
||||
});
|
||||
}
|
||||
@@ -100,8 +105,9 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void configureWhenBuilderCustomizerShouldApply() {
|
||||
this.contextRunner.withUserConfiguration(BuilderCustomizerConfiguration.class).run((context) -> {
|
||||
assertThat(context).hasSingleBean(RestHighLevelClient.class);
|
||||
RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class);
|
||||
assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
org.elasticsearch.client.RestHighLevelClient restClient = context
|
||||
.getBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
RestClient lowLevelClient = restClient.getLowLevelClient();
|
||||
assertThat(lowLevelClient).hasFieldOrPropertyWithValue("pathPrefix", "/test");
|
||||
assertThat(lowLevelClient).extracting("client.connmgr.pool.maxTotal").isEqualTo(100);
|
||||
@@ -112,8 +118,9 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void configureWithNoTimeoutsApplyDefaults() {
|
||||
this.contextRunner.run((context) -> {
|
||||
assertThat(context).hasSingleBean(RestHighLevelClient.class);
|
||||
RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class);
|
||||
assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
org.elasticsearch.client.RestHighLevelClient restClient = context
|
||||
.getBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
assertTimeouts(restClient, Duration.ofMillis(RestClientBuilder.DEFAULT_CONNECT_TIMEOUT_MILLIS),
|
||||
Duration.ofMillis(RestClientBuilder.DEFAULT_SOCKET_TIMEOUT_MILLIS));
|
||||
});
|
||||
@@ -123,8 +130,9 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
void configureWithLegacyCustomTimeouts() {
|
||||
this.contextRunner.withPropertyValues("spring.elasticsearch.rest.connection-timeout=15s",
|
||||
"spring.elasticsearch.rest.read-timeout=1m").run((context) -> {
|
||||
assertThat(context).hasSingleBean(RestHighLevelClient.class);
|
||||
RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class);
|
||||
assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
org.elasticsearch.client.RestHighLevelClient restClient = context
|
||||
.getBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
assertTimeouts(restClient, Duration.ofSeconds(15), Duration.ofMinutes(1));
|
||||
});
|
||||
}
|
||||
@@ -133,13 +141,15 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
void configureWithCustomTimeouts() {
|
||||
this.contextRunner.withPropertyValues("spring.elasticsearch.connection-timeout=15s",
|
||||
"spring.elasticsearch.socket-timeout=1m").run((context) -> {
|
||||
assertThat(context).hasSingleBean(RestHighLevelClient.class);
|
||||
RestHighLevelClient restClient = context.getBean(RestHighLevelClient.class);
|
||||
assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
org.elasticsearch.client.RestHighLevelClient restClient = context
|
||||
.getBean(org.elasticsearch.client.RestHighLevelClient.class);
|
||||
assertTimeouts(restClient, Duration.ofSeconds(15), Duration.ofMinutes(1));
|
||||
});
|
||||
}
|
||||
|
||||
private static void assertTimeouts(RestHighLevelClient restClient, Duration connectTimeout, Duration readTimeout) {
|
||||
private static void assertTimeouts(org.elasticsearch.client.RestHighLevelClient restClient, Duration connectTimeout,
|
||||
Duration readTimeout) {
|
||||
assertThat(restClient.getLowLevelClient()).extracting("client.defaultConfig.socketTimeout")
|
||||
.isEqualTo(Math.toIntExact(readTimeout.toMillis()));
|
||||
assertThat(restClient.getLowLevelClient()).extracting("client.defaultConfig.connectTimeout")
|
||||
@@ -149,7 +159,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@ParameterizedPropertyPrefixTest
|
||||
void configureUriWithNoScheme(String prefix) {
|
||||
this.contextRunner.withPropertyValues(prefix + "uris=localhost:9876").run((context) -> {
|
||||
RestClient client = context.getBean(RestHighLevelClient.class).getLowLevelClient();
|
||||
RestClient client = context.getBean(org.elasticsearch.client.RestHighLevelClient.class).getLowLevelClient();
|
||||
assertThat(client.getNodes().stream().map(Node::getHost).map(HttpHost::toString))
|
||||
.containsExactly("http://localhost:9876");
|
||||
});
|
||||
@@ -158,7 +168,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@ParameterizedPropertyPrefixTest
|
||||
void configureUriWithUsernameOnly(String prefix) {
|
||||
this.contextRunner.withPropertyValues(prefix + "uris=http://user@localhost:9200").run((context) -> {
|
||||
RestClient client = context.getBean(RestHighLevelClient.class).getLowLevelClient();
|
||||
RestClient client = context.getBean(org.elasticsearch.client.RestHighLevelClient.class).getLowLevelClient();
|
||||
assertThat(client.getNodes().stream().map(Node::getHost).map(HttpHost::toString))
|
||||
.containsExactly("http://localhost:9200");
|
||||
assertThat(client)
|
||||
@@ -174,7 +184,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@ParameterizedPropertyPrefixTest
|
||||
void configureUriWithUsernameAndEmptyPassword(String prefix) {
|
||||
this.contextRunner.withPropertyValues(prefix + "uris=http://user:@localhost:9200").run((context) -> {
|
||||
RestClient client = context.getBean(RestHighLevelClient.class).getLowLevelClient();
|
||||
RestClient client = context.getBean(org.elasticsearch.client.RestHighLevelClient.class).getLowLevelClient();
|
||||
assertThat(client.getNodes().stream().map(Node::getHost).map(HttpHost::toString))
|
||||
.containsExactly("http://localhost:9200");
|
||||
assertThat(client)
|
||||
@@ -191,7 +201,8 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
void configureUriWithUsernameAndPasswordWhenUsernameAndPasswordPropertiesSet(String prefix) {
|
||||
this.contextRunner.withPropertyValues(prefix + "uris=http://user:password@localhost:9200,localhost:9201",
|
||||
prefix + "username=admin", prefix + "password=admin").run((context) -> {
|
||||
RestClient client = context.getBean(RestHighLevelClient.class).getLowLevelClient();
|
||||
RestClient client = context.getBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
.getLowLevelClient();
|
||||
assertThat(client.getNodes().stream().map(Node::getHost).map(HttpHost::toString))
|
||||
.containsExactly("http://localhost:9200", "http://localhost:9201");
|
||||
assertThat(client)
|
||||
@@ -213,7 +224,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void configureWithCustomPathPrefix() {
|
||||
this.contextRunner.withPropertyValues("spring.elasticsearch.path-prefix=/some/prefix").run((context) -> {
|
||||
RestClient client = context.getBean(RestHighLevelClient.class).getLowLevelClient();
|
||||
RestClient client = context.getBean(org.elasticsearch.client.RestHighLevelClient.class).getLowLevelClient();
|
||||
assertThat(client).extracting("pathPrefix").isEqualTo("/some/prefix");
|
||||
});
|
||||
}
|
||||
@@ -221,7 +232,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
@Test
|
||||
void configureWithoutSnifferLibraryShouldNotCreateSniffer() {
|
||||
this.contextRunner.withClassLoader(new FilteredClassLoader("org.elasticsearch.client.sniff"))
|
||||
.run((context) -> assertThat(context).hasSingleBean(RestHighLevelClient.class)
|
||||
.run((context) -> assertThat(context).hasSingleBean(org.elasticsearch.client.RestHighLevelClient.class)
|
||||
.doesNotHaveBean(Sniffer.class));
|
||||
}
|
||||
|
||||
@@ -230,7 +241,7 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
this.contextRunner.run((context) -> {
|
||||
assertThat(context).hasSingleBean(Sniffer.class);
|
||||
assertThat(context.getBean(Sniffer.class)).hasFieldOrPropertyWithValue("restClient",
|
||||
context.getBean(RestHighLevelClient.class).getLowLevelClient());
|
||||
context.getBean(org.elasticsearch.client.RestHighLevelClient.class).getLowLevelClient());
|
||||
// Validate shutdown order as the sniffer must be shutdown before the client
|
||||
assertThat(context.getBeanFactory().getDependentBeans("elasticsearchRestHighLevelClient"))
|
||||
.contains("elasticsearchSniffer");
|
||||
@@ -292,8 +303,8 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
static class CustomRestHighLevelClientConfiguration {
|
||||
|
||||
@Bean
|
||||
RestHighLevelClient customRestHighLevelClient(RestClientBuilder builder) {
|
||||
return new RestHighLevelClient(builder);
|
||||
org.elasticsearch.client.RestHighLevelClient customRestHighLevelClient(RestClientBuilder builder) {
|
||||
return new org.elasticsearch.client.RestHighLevelClient(builder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -302,13 +313,13 @@ class ElasticsearchRestClientAutoConfigurationTests {
|
||||
static class TwoCustomRestHighLevelClientConfiguration {
|
||||
|
||||
@Bean
|
||||
RestHighLevelClient customRestHighLevelClient(RestClientBuilder builder) {
|
||||
return new RestHighLevelClient(builder);
|
||||
org.elasticsearch.client.RestHighLevelClient customRestHighLevelClient(RestClientBuilder builder) {
|
||||
return new org.elasticsearch.client.RestHighLevelClient(builder);
|
||||
}
|
||||
|
||||
@Bean
|
||||
RestHighLevelClient customRestHighLevelClient1(RestClientBuilder builder) {
|
||||
return new RestHighLevelClient(builder);
|
||||
org.elasticsearch.client.RestHighLevelClient customoRestHighLevelClient1(RestClientBuilder builder) {
|
||||
return new org.elasticsearch.client.RestHighLevelClient(builder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ bom {
|
||||
]
|
||||
}
|
||||
}
|
||||
library("Elasticsearch", "7.15.2") {
|
||||
library("Elasticsearch", "7.16.0") {
|
||||
group("org.elasticsearch") {
|
||||
modules = [
|
||||
"elasticsearch"
|
||||
|
||||
Reference in New Issue
Block a user