Merge branch '4.1.x'

Closes gh-51764
This commit is contained in:
Andy Wilkinson
2026-09-15 13:03:19 +01:00
8 changed files with 17 additions and 35 deletions
@@ -174,7 +174,7 @@ class ConditionalOnPropertyTests {
@Test
void relaxedEnabledByDefault() {
load(PrefixValueConfig.class, "simple.myProperty:bar");
load(PrefixValueConfig.class, "simple.my-property:bar");
assertThat(containsBean()).isTrue();
}
@@ -81,12 +81,6 @@ class ConfigDataResourceNotFoundExceptionTests {
assertThat(exception.getCause()).isSameAs(this.cause);
}
@Test
void getResourceReturnsResource() {
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(this.resource);
assertThat(exception.getResource()).isSameAs(this.resource);
}
@Test
void getLocationWhenHasNoLocationReturnsNull() {
ConfigDataResourceNotFoundException exception = new ConfigDataResourceNotFoundException(this.resource);
@@ -294,16 +294,15 @@ class EnvironmentEndpointTests {
@Test
void propertyEntryWhenShowWhenAuthorized() {
testPropertyEntry(Show.ALWAYS, "bar", "another");
testPropertyEntry(Show.WHEN_AUTHORIZED, "bar", "another");
}
private void testPropertyEntry(Show always, String bar, String another) {
private void testPropertyEntry(Show show, String bar, String another) {
TestPropertyValues.of("my.foo=another").applyToSystemProperties(() -> {
StandardEnvironment environment = new StandardEnvironment();
TestPropertyValues.of("my.foo=bar", "my.foo2=bar2")
.applyTo(environment, TestPropertyValues.Type.MAP, "test");
EnvironmentEntryDescriptor descriptor = new EnvironmentEndpoint(environment, Collections.emptyList(),
always)
EnvironmentEntryDescriptor descriptor = new EnvironmentEndpoint(environment, Collections.emptyList(), show)
.environmentEntry("my.foo");
assertThat(descriptor).isNotNull();
assertThat(descriptor.getProperty()).isNotNull();
@@ -60,13 +60,7 @@ class ChangeableUrlsTests {
}
@Test
void httpUrl() throws Exception {
URL url = new URL("https://spring.io");
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}
@Test
void httpsUrl() throws Exception {
void nonFileUrl() throws Exception {
URL url = new URL("https://spring.io");
assertThat(ChangeableUrls.fromUrls(url)).isEmpty();
}
@@ -102,9 +102,16 @@ class EntityManagerFactoryBuilderTests {
assertThatNoException().isThrownBy(builder.dataSource(dataSource)::build);
}
/**
* @deprecated since 4.1.1 for removal in 4.3.0
*/
@Test
@Deprecated(since = "4.1.1", forRemoval = true)
@SuppressWarnings("removal")
void requireBootstrapExecutorWhenFallbackExecutorProvidesExecutorDoesNotThrow() {
EntityManagerFactoryBuilder builder = createEmptyBuilder(SimpleAsyncTaskExecutor::new);
Function<DataSource, Map<String, ?>> jpaPropertiesFactory = (dataSource) -> Collections.emptyMap();
EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(new TestJpaVendorAdapter(),
jpaPropertiesFactory, null, null, new SimpleAsyncTaskExecutor());
builder.requireBootstrapExecutor(() -> new IllegalStateException("BAD"));
DataSource dataSource = mock();
assertThatNoException().isThrownBy(builder.dataSource(dataSource)::build);
@@ -58,7 +58,8 @@ class MongoAutoConfigurationTests {
@Test
void settingsAdded() {
this.contextRunner.withUserConfiguration(SettingsConfig.class)
this.contextRunner.withPropertyValues("spring.mongodb.host:localhost")
.withUserConfiguration(SettingsConfig.class)
.run((context) -> assertThat(
getSettings(context).getSocketSettings().getConnectTimeout(TimeUnit.MILLISECONDS))
.isEqualTo(300));
@@ -66,7 +67,8 @@ class MongoAutoConfigurationTests {
@Test
void settingsAddedButNoHost() {
this.contextRunner.withUserConfiguration(SettingsConfig.class)
this.contextRunner.withPropertyValues("spring.mongodb.uri:mongodb://localhost/test")
.withUserConfiguration(SettingsConfig.class)
.run((context) -> assertThat(
getSettings(context).getSocketSettings().getConnectTimeout(TimeUnit.MILLISECONDS))
.isEqualTo(300));
@@ -259,14 +259,6 @@ class Neo4jAutoConfigurationTests {
assertThat(mapDriverConfig(properties).encrypted()).isTrue();
}
@Test
void securityWithTrustSignedCertificates() {
Neo4jProperties properties = new Neo4jProperties();
properties.getSecurity().setTrustStrategy(TrustStrategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES);
assertThat(mapDriverConfig(properties).trustStrategy().strategy())
.isEqualTo(Config.TrustStrategy.Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES);
}
@Test
void securityWithTrustAllCertificates() {
Neo4jProperties properties = new Neo4jProperties();
@@ -172,12 +172,6 @@ class TomcatServerPropertiesTests {
assertThat(this.properties.getThreads().getMinSpare()).isEqualTo(getDefaultProtocol().getMinSpareThreads());
}
@Test
void tomcatMaxHttpPostSizeMatchesConnectorDefault() {
assertThat(this.properties.getMaxHttpFormPostSize().toBytes())
.isEqualTo(getDefaultConnector().getMaxPostSize());
}
@Test
void tomcatMaxParameterCountMatchesConnectorDefault() {
assertThat(this.properties.getMaxParameterCount()).isEqualTo(getDefaultConnector().getMaxParameterCount());