Start building against Spring Data 2021.1.0-M3 snapshots

See gh-27932
pull/27940/head
Stephane Nicoll 3 years ago
parent 726a2591fb
commit 599cc1f696

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -73,14 +73,14 @@ public class ReactiveElasticsearchRestClientAutoConfiguration {
private void configureExchangeStrategies(ClientConfiguration.TerminalClientConfigurationBuilder builder,
ReactiveElasticsearchRestClientProperties properties) {
PropertyMapper map = PropertyMapper.get();
builder.withWebClientConfigurer((webClient) -> {
builder.withClientConfigurer(ReactiveRestClients.WebClientConfigurationCallback.from((webClient) -> {
ExchangeStrategies exchangeStrategies = ExchangeStrategies.builder()
.codecs((configurer) -> map.from(properties.getMaxInMemorySize()).whenNonNull()
.asInt(DataSize::toBytes)
.to((maxInMemorySize) -> configurer.defaultCodecs().maxInMemorySize(maxInMemorySize)))
.build();
return webClient.mutate().exchangeStrategies(exchangeStrategies).build();
});
}));
}
@Bean

@ -28,7 +28,9 @@ import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.ClientConfiguration.ClientConfigurationCallback;
import org.springframework.data.elasticsearch.client.reactive.ReactiveElasticsearchClient;
import org.springframework.data.elasticsearch.client.reactive.ReactiveRestClients;
import org.springframework.http.HttpHeaders;
import org.springframework.http.codec.CodecConfigurer.DefaultCodecConfig;
import org.springframework.web.reactive.function.client.WebClient;
@ -136,8 +138,8 @@ class ReactiveElasticsearchRestClientAutoConfigurationTests {
void whenMaxInMemorySizeIsConfiguredThenUnderlyingWebClientHasCustomMaxInMemorySize() {
this.contextRunner.withPropertyValues("spring.data.elasticsearch.client.reactive.max-in-memory-size=1MB")
.run((context) -> {
WebClient client = context.getBean(ClientConfiguration.class).getWebClientConfigurer()
.apply(WebClient.create());
WebClient client = configureWebClient(
context.getBean(ClientConfiguration.class).getClientConfigurers());
assertThat(client).extracting("exchangeFunction").extracting("strategies")
.extracting("codecConfigurer").extracting("defaultCodecs")
.asInstanceOf(InstanceOfAssertFactories.type(DefaultCodecConfig.class))
@ -145,6 +147,14 @@ class ReactiveElasticsearchRestClientAutoConfigurationTests {
});
}
private WebClient configureWebClient(List<ClientConfigurationCallback<?>> callbacks) {
WebClient webClient = WebClient.create();
for (ClientConfigurationCallback<?> callback : callbacks) {
webClient = ((ReactiveRestClients.WebClientConfigurationCallback) callback).configure(webClient);
}
return webClient;
}
@Configuration(proxyBeanMethods = false)
static class CustomClientConfiguration {

@ -1627,7 +1627,7 @@ bom {
]
}
}
library("Spring Data Bom", "2021.1.0-M2") {
library("Spring Data Bom", "2021.1.0-SNAPSHOT") {
group("org.springframework.data") {
imports = [
"spring-data-bom"

Loading…
Cancel
Save