Merge branch '2.7.x'

This commit is contained in:
Andy Wilkinson
2022-05-26 18:22:27 +01:00
35 changed files with 99 additions and 286 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -17,10 +17,11 @@
package org.springframework.boot.autoconfigure.data.redis;
import io.lettuce.core.resource.ClientResources;
import io.lettuce.core.resource.ClientResources.Builder;
/**
* Callback interface that can be implemented by beans wishing to customize the
* {@link ClientResources} via a {@link ClientResources.Builder} whilst retaining default
* {@link ClientResources} via a {@link Builder} whilst retaining default
* auto-configuration.
*
* @author Stephane Nicoll
@@ -29,9 +30,9 @@ import io.lettuce.core.resource.ClientResources;
public interface ClientResourcesBuilderCustomizer {
/**
* Customize the {@link ClientResources.Builder}.
* Customize the {@link Builder}.
* @param clientResourcesBuilder the builder to customize
*/
void customize(ClientResources.Builder clientResourcesBuilder);
void customize(Builder clientResourcesBuilder);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2022 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.
@@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.elasticsearch;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.config.RequestConfig.Builder;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClientBuilder;
@@ -52,11 +53,11 @@ public interface RestClientBuilderCustomizer {
}
/**
* Customize the {@link RequestConfig.Builder}.
* Customize the {@link Builder}.
* @param builder the builder
* @since 2.3.0
*/
default void customize(RequestConfig.Builder builder) {
default void customize(Builder builder) {
}
}

View File

@@ -325,10 +325,6 @@ public class FlywayAutoConfiguration {
}
}
private String normalizePrefix(String location) {
return location.replace("filesystem:", "file:");
}
@Bean
@ConditionalOnMissingBean
public FlywayMigrationInitializer flywayInitializer(Flyway flyway,

View File

@@ -48,13 +48,6 @@ public class FlywayProperties {
*/
private boolean enabled = true;
/**
* Whether to check that migration scripts location exists. Should be set to false
* when using a wildcard location or a remote-hosted location such as S3 or GCS.
*/
@Deprecated
private boolean checkLocation = true;
/**
* Whether to fail if a location of migration scripts doesn't exist.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -28,15 +28,15 @@ import org.springframework.boot.r2dbc.EmbeddedDatabaseConnection;
import org.springframework.util.StringUtils;
/**
* Initialize a {@link ConnectionFactoryOptions.Builder} based on {@link R2dbcProperties}.
* Initialize a {@link Builder} based on {@link R2dbcProperties}.
*
* @author Stephane Nicoll
*/
class ConnectionFactoryOptionsInitializer {
/**
* Initialize a {@link io.r2dbc.spi.ConnectionFactoryOptions.Builder
* ConnectionFactoryOptions.Builder} using the specified properties.
* Initialize a {@link Builder ConnectionFactoryOptions.Builder} using the specified
* properties.
* @param properties the properties to use to initialize the builder
* @param embeddedDatabaseConnection the embedded connection to use as a fallback
* @return an initialized builder

View File

@@ -157,7 +157,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
.getBean(SupplierReactiveJwtDecoder.class);
Mono<ReactiveJwtDecoder> reactiveJwtDecoderSupplier = (Mono<ReactiveJwtDecoder>) ReflectionTestUtils
.getField(supplierReactiveJwtDecoder, "jwtDecoderMono");
ReactiveJwtDecoder reactiveJwtDecoder = reactiveJwtDecoderSupplier.block(TIMEOUT);
reactiveJwtDecoderSupplier.block(TIMEOUT);
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(1);
@@ -180,7 +180,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
.getBean(SupplierReactiveJwtDecoder.class);
Mono<ReactiveJwtDecoder> reactiveJwtDecoderSupplier = (Mono<ReactiveJwtDecoder>) ReflectionTestUtils
.getField(supplierReactiveJwtDecoder, "jwtDecoderMono");
ReactiveJwtDecoder reactiveJwtDecoder = reactiveJwtDecoderSupplier.block(TIMEOUT);
reactiveJwtDecoderSupplier.block(TIMEOUT);
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(2);
@@ -203,7 +203,7 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
.getBean(SupplierReactiveJwtDecoder.class);
Mono<ReactiveJwtDecoder> reactiveJwtDecoderSupplier = (Mono<ReactiveJwtDecoder>) ReflectionTestUtils
.getField(supplierReactiveJwtDecoder, "jwtDecoderMono");
ReactiveJwtDecoder reactiveJwtDecoder = reactiveJwtDecoderSupplier.block(TIMEOUT);
reactiveJwtDecoderSupplier.block(TIMEOUT);
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(3);
@@ -420,7 +420,6 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
});
}
@SuppressWarnings("unchecked")
@Test
void autoConfigurationShouldConfigureIssuerAndAudienceJwtValidatorIfPropertyProvided() throws Exception {
this.server = new MockWebServer();
@@ -490,7 +489,6 @@ class ReactiveOAuth2ResourceServerAutoConfigurationTests {
});
}
@SuppressWarnings("unchecked")
@Test
void autoConfigurationShouldConfigureAudienceValidatorIfPropertyProvidedAndPublicKey() throws Exception {
this.server = new MockWebServer();

View File

@@ -149,7 +149,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
SupplierJwtDecoder supplierJwtDecoderBean = context.getBean(SupplierJwtDecoder.class);
Supplier<JwtDecoder> jwtDecoderSupplier = (Supplier<JwtDecoder>) ReflectionTestUtils
.getField(supplierJwtDecoderBean, "jwtDecoderSupplier");
JwtDecoder jwtDecoder = jwtDecoderSupplier.get();
jwtDecoderSupplier.get();
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(2);
@@ -171,7 +171,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
SupplierJwtDecoder supplierJwtDecoderBean = context.getBean(SupplierJwtDecoder.class);
Supplier<JwtDecoder> jwtDecoderSupplier = (Supplier<JwtDecoder>) ReflectionTestUtils
.getField(supplierJwtDecoderBean, "jwtDecoderSupplier");
JwtDecoder jwtDecoder = jwtDecoderSupplier.get();
jwtDecoderSupplier.get();
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(3);
@@ -194,7 +194,7 @@ class OAuth2ResourceServerAutoConfigurationTests {
SupplierJwtDecoder supplierJwtDecoderBean = context.getBean(SupplierJwtDecoder.class);
Supplier<JwtDecoder> jwtDecoderSupplier = (Supplier<JwtDecoder>) ReflectionTestUtils
.getField(supplierJwtDecoderBean, "jwtDecoderSupplier");
JwtDecoder jwtDecoder = jwtDecoderSupplier.get();
jwtDecoderSupplier.get();
});
// The last request is to the JWK Set endpoint to look up the algorithm
assertThat(this.server.getRequestCount()).isEqualTo(4);
@@ -433,7 +433,6 @@ class OAuth2ResourceServerAutoConfigurationTests {
});
}
@SuppressWarnings("unchecked")
@Test
void autoConfigurationShouldConfigureAudienceAndIssuerJwtValidatorIfPropertyProvided() throws Exception {
this.server = new MockWebServer();
@@ -502,7 +501,6 @@ class OAuth2ResourceServerAutoConfigurationTests {
}
}
@SuppressWarnings("unchecked")
@Test
void autoConfigurationShouldConfigureAudienceValidatorIfPropertyProvidedAndPublicKey() throws Exception {
this.server = new MockWebServer();

View File

@@ -280,9 +280,11 @@ class Saml2RelyingPartyAutoConfigurationTests {
private void setupMockResponse(MockWebServer server, Resource resourceBody) throws Exception {
try (InputStream metadataSource = resourceBody.getInputStream()) {
Buffer metadataBuffer = new Buffer().readFrom(metadataSource);
MockResponse metadataResponse = new MockResponse().setBody(metadataBuffer);
server.enqueue(metadataResponse);
try (Buffer metadataBuffer = new Buffer()) {
metadataBuffer.readFrom(metadataSource);
MockResponse metadataResponse = new MockResponse().setBody(metadataBuffer);
server.enqueue(metadataResponse);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 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.
@@ -17,8 +17,6 @@
package org.springframework.boot.autoconfigure.web.reactive;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.jupiter.api.Test;
@@ -44,9 +42,6 @@ class ReactiveMultipartAutoConfigurationTests {
private final ReactiveWebApplicationContextRunner contextRunner = new ReactiveWebApplicationContextRunner()
.withConfiguration(AutoConfigurations.of(ReactiveMultipartAutoConfiguration.class));
private static final Path DEFAULT_FILE_STORAGE_DIRECTORY = Paths.get(System.getProperty("java.io.tmpdir"),
"spring-multipart");
@Test
void shouldNotProvideCustomizerForNonReactiveApp() {
new WebApplicationContextRunner()

View File

@@ -838,6 +838,7 @@ class WebMvcAutoConfigurationTests {
@Test
@Deprecated
@SuppressWarnings("deprecation")
void useSuffixPatternMatch() {
this.contextRunner.withPropertyValues("spring.mvc.pathmatch.matching-strategy=ant-path-matcher",
"spring.mvc.pathmatch.use-suffix-pattern:true",