Skip to content

Commit da5796f

Browse files
committed
Merge branch '3.4.x'
Closes gh-44635
2 parents dde9bfb + ab66034 commit da5796f

File tree

47 files changed

+178
-169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+178
-169
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java

+16
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
5454
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
5555
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
56+
import org.springframework.boot.testsupport.classpath.resources.WithResource;
5657
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
5758
import org.springframework.context.ApplicationContext;
5859
import org.springframework.context.annotation.Bean;
@@ -272,6 +273,21 @@ void healthEndpointInvokerShouldBeCloudFoundryWebExtension() {
272273
}
273274

274275
@Test
276+
@WithResource(name = "git.properties", content = """
277+
#Generated by Git-Commit-Id-Plugin
278+
#Thu May 23 09:26:42 BST 2013
279+
git.commit.id.abbrev=e02a4f3
280+
281+
git.commit.message.full=Update Spring
282+
git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
283+
git.commit.message.short=Update Spring
284+
git.commit.user.name=Dave Syer
285+
git.build.user.name=Dave Syer
286+
287+
git.branch=develop
288+
git.commit.time=2013-04-24T08\\:42\\:13+0100
289+
git.build.time=2013-05-23T09\\:26\\:42+0100
290+
""")
275291
@SuppressWarnings("unchecked")
276292
void gitFullDetailsAlwaysPresent() {
277293
this.contextRunner.withPropertyValues("VCAP_APPLICATION:---").run((context) -> {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryInfoEndpointWebExtensionTests.java

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
3838
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
3939
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
40+
import org.springframework.boot.testsupport.classpath.resources.WithResource;
4041

4142
import static org.assertj.core.api.Assertions.assertThat;
4243

@@ -59,6 +60,21 @@ class CloudFoundryInfoEndpointWebExtensionTests {
5960
HealthEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class));
6061

6162
@Test
63+
@WithResource(name = "git.properties", content = """
64+
#Generated by Git-Commit-Id-Plugin
65+
#Thu May 23 09:26:42 BST 2013
66+
git.commit.id.abbrev=e02a4f3
67+
68+
git.commit.message.full=Update Spring
69+
git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
70+
git.commit.message.short=Update Spring
71+
git.commit.user.name=Dave Syer
72+
git.build.user.name=Dave Syer
73+
74+
git.branch=develop
75+
git.commit.time=2013-04-24T08\\:42\\:13+0100
76+
git.build.time=2013-05-23T09\\:26\\:42+0100
77+
""")
6278
@SuppressWarnings("unchecked")
6379
void gitFullDetailsAlwaysPresent() {
6480
this.contextRunner.run((context) -> {

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@
2121
import org.junit.jupiter.api.AfterEach;
2222
import org.junit.jupiter.api.Test;
2323

24+
import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
2425
import org.springframework.boot.testsupport.web.servlet.ExampleServlet;
2526
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
2627
import org.springframework.boot.web.server.Ssl;
@@ -49,6 +50,7 @@ void shutdownContainer() {
4950
}
5051

5152
@Test
53+
@WithPackageResources("test.jks")
5254
void restCallToSelfSignedServerShouldNotThrowSslException() {
5355
String httpsUrl = getHttpsUrl();
5456
SkipSslVerificationHttpRequestFactory requestFactory = new SkipSslVerificationHttpRequestFactory();

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
3434
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
3535
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
3636
import org.springframework.restdocs.payload.FieldDescriptor;
37+
import org.springframework.test.context.TestPropertySource;
3738

3839
import static org.assertj.core.api.Assertions.assertThat;
3940
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
@@ -44,6 +45,8 @@
4445
*
4546
* @author Andy Wilkinson
4647
*/
48+
@TestPropertySource(
49+
properties = "spring.flyway.locations=classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation")
4750
class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4851

4952
@Test

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
3232
import org.springframework.restdocs.payload.FieldDescriptor;
3333
import org.springframework.restdocs.payload.JsonFieldType;
34+
import org.springframework.test.context.TestPropertySource;
3435

3536
import static org.assertj.core.api.Assertions.assertThat;
3637
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
@@ -41,6 +42,8 @@
4142
*
4243
* @author Andy Wilkinson
4344
*/
45+
@TestPropertySource(
46+
properties = "spring.liquibase.change-log=classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/db.changelog-master.yaml")
4447
class LiquibaseEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
4548

4649
@Test

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SbomEndpointDocumentationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,7 +58,9 @@ static class TestConfiguration {
5858
@Bean
5959
SbomProperties sbomProperties() {
6060
SbomProperties properties = new SbomProperties();
61-
properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
61+
properties.getApplication()
62+
.setLocation(
63+
"classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/cyclonedx.json");
6264
return properties;
6365
}
6466

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,6 +26,7 @@
2626
import org.springframework.boot.autoconfigure.AutoConfigurations;
2727
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
2828
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
29+
import org.springframework.boot.testsupport.classpath.resources.WithResource;
2930

3031
import static org.assertj.core.api.Assertions.assertThat;
3132

@@ -34,6 +35,20 @@
3435
*
3536
* @author Dmytro Nosan
3637
*/
38+
@WithResource(name = "hazelcast.xml", content = """
39+
<hazelcast
40+
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-5.0.xsd"
41+
xmlns="http://www.hazelcast.com/schema/config"
42+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
43+
<map name="defaultCache" />
44+
<network>
45+
<join>
46+
<auto-detection enabled="false"/>
47+
<multicast enabled="false"/>
48+
</join>
49+
</network>
50+
</hazelcast>
51+
""")
3752
class HazelcastHealthContributorAutoConfigurationIntegrationTests {
3853

3954
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
2323
import org.springframework.boot.autoconfigure.AutoConfigurations;
2424
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
2525
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
26+
import org.springframework.boot.testsupport.classpath.resources.WithResource;
2627

2728
import static org.assertj.core.api.Assertions.assertThat;
2829

@@ -31,6 +32,20 @@
3132
*
3233
* @author Dmytro Nosan
3334
*/
35+
@WithResource(name = "hazelcast.xml", content = """
36+
<hazelcast
37+
xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-5.0.xsd"
38+
xmlns="http://www.hazelcast.com/schema/config"
39+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
40+
<map name="defaultCache" />
41+
<network>
42+
<join>
43+
<auto-detection enabled="false"/>
44+
<multicast enabled="false"/>
45+
</join>
46+
</network>
47+
</hazelcast>
48+
""")
3449
class HazelcastHealthContributorAutoConfigurationTests {
3550

3651
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java

+12
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
4242
import org.springframework.boot.test.context.FilteredClassLoader;
4343
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
44+
import org.springframework.boot.testsupport.classpath.resources.WithResource;
4445
import org.springframework.context.annotation.Bean;
4546
import org.springframework.context.annotation.Configuration;
4647
import org.springframework.context.annotation.Primary;
@@ -138,6 +139,17 @@ void entityManagerFactoryInstrumentationIsDisabledIfHibernateIsNotAvailable() {
138139
}
139140

140141
@Test
142+
@WithResource(name = "city-schema.sql", content = """
143+
CREATE TABLE CITY (
144+
id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
145+
name VARCHAR(30),
146+
state VARCHAR(30),
147+
country VARCHAR(30),
148+
map VARCHAR(30)
149+
);
150+
""")
151+
@WithResource(name = "city-data.sql",
152+
content = "INSERT INTO CITY (ID, NAME, STATE, COUNTRY, MAP) values (2000, 'Washington', 'DC', 'US', 'Google');")
141153
void entityManagerFactoryInstrumentationDoesNotDeadlockWithDeferredInitialization() {
142154
this.contextRunner
143155
.withPropertyValues("spring.jpa.properties.hibernate.generate_statistics:true",

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
import org.springframework.boot.context.event.ApplicationStartedEvent;
3232
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
3333
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
34+
import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
3435
import org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory;
3536
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
3637
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext;
@@ -132,13 +133,14 @@ void allowsCustomJettyConnectionMetricsBinderToBeUsed() {
132133
}
133134

134135
@Test
136+
@WithPackageResources("test.jks")
135137
void autoConfiguresSslHandshakeMetricsWithEmbeddedServletJetty() {
136138
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
137139
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
138140
ServletWebServerFactoryAutoConfiguration.class))
139141
.withUserConfiguration(ServletWebServerConfiguration.class, MeterRegistryConfiguration.class)
140-
.withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
141-
"server.ssl.key-store-password: secret", "server.ssl.key-password: password")
142+
.withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
143+
"server.ssl.key-store-password=secret", "server.ssl.key-password=password")
142144
.run((context) -> {
143145
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
144146
assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class);
@@ -148,13 +150,14 @@ void autoConfiguresSslHandshakeMetricsWithEmbeddedServletJetty() {
148150
}
149151

150152
@Test
153+
@WithPackageResources("test.jks")
151154
void autoConfiguresSslHandshakeMetricsWithEmbeddedReactiveJetty() {
152155
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new)
153156
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
154157
ReactiveWebServerFactoryAutoConfiguration.class))
155158
.withUserConfiguration(ReactiveWebServerConfiguration.class, MeterRegistryConfiguration.class)
156-
.withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
157-
"server.ssl.key-store-password: secret", "server.ssl.key-password: password")
159+
.withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
160+
"server.ssl.key-store-password=secret", "server.ssl.key-password=password")
158161
.run((context) -> {
159162
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
160163
SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class);
@@ -163,14 +166,15 @@ void autoConfiguresSslHandshakeMetricsWithEmbeddedReactiveJetty() {
163166
}
164167

165168
@Test
169+
@WithPackageResources("test.jks")
166170
void allowsCustomJettySslHandshakeMetricsBinderToBeUsed() {
167171
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
168172
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
169173
ServletWebServerFactoryAutoConfiguration.class))
170174
.withUserConfiguration(ServletWebServerConfiguration.class, CustomJettySslHandshakeMetricsBinder.class,
171175
MeterRegistryConfiguration.class)
172-
.withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
173-
"server.ssl.key-store-password: secret", "server.ssl.key-password: password")
176+
.withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
177+
"server.ssl.key-store-password=secret", "server.ssl.key-password=password")
174178
.run((context) -> {
175179
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
176180
assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class)

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@
3737
import org.springframework.boot.test.context.FilteredClassLoader;
3838
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
3939
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
40+
import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
4041
import org.springframework.boot.web.context.WebServerApplicationContext;
4142
import org.springframework.boot.web.server.WebServer;
4243
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext;
@@ -143,13 +144,14 @@ void backOffIfOAuth2ResourceServerAutoConfigurationPresent() {
143144
}
144145

145146
@Test
147+
@WithPackageResources("saml-certificate")
146148
void backOffIfSaml2RelyingPartyAutoConfigurationPresent() {
147149
this.contextRunner.withConfiguration(AutoConfigurations.of(Saml2RelyingPartyAutoConfiguration.class))
148150
.withPropertyValues(
149151
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.url=https://simplesaml-for-spring-saml/SSOService.php",
150152
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.sign-request=false",
151153
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
152-
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.verification.credentials[0].certificate-location=classpath:saml/certificate-location")
154+
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.verification.credentials[0].certificate-location=classpath:saml-certificate")
153155
.run((context) -> assertThat(context).doesNotHaveBean(ManagementWebSecurityAutoConfiguration.class)
154156
.doesNotHaveBean(MANAGEMENT_SECURITY_FILTER_CHAIN_BEAN));
155157
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthContributorAutoConfigurationTests.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
import org.springframework.boot.info.SslInfo.CertificateChainInfo;
3333
import org.springframework.boot.ssl.SslBundles;
3434
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
35+
import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
3536
import org.springframework.context.annotation.Bean;
3637
import org.springframework.context.annotation.Configuration;
3738

@@ -42,6 +43,7 @@
4243
*
4344
* @author Jonatan Ivanov
4445
*/
46+
@WithPackageResources("test.jks")
4547
class SslHealthContributorAutoConfigurationTests {
4648

4749
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/actuator-docs-index.html

-1
This file was deleted.

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-data.sql

-1
This file was deleted.

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-schema.sql

-7
This file was deleted.

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/create-custom-schema.sql

-1
This file was deleted.

0 commit comments

Comments
 (0)