diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java
index cddbd59bea..856bb2af97 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveCloudFoundryActuatorAutoConfigurationTests.java
@@ -53,6 +53,7 @@ import org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurity
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
import org.springframework.boot.autoconfigure.web.reactive.function.client.WebClientAutoConfiguration;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.boot.web.reactive.function.client.WebClientCustomizer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -272,6 +273,21 @@ class ReactiveCloudFoundryActuatorAutoConfigurationTests {
}
@Test
+ @WithResource(name = "git.properties", content = """
+ #Generated by Git-Commit-Id-Plugin
+ #Thu May 23 09:26:42 BST 2013
+ git.commit.id.abbrev=e02a4f3
+ git.commit.user.email=dsyer@vmware.com
+ git.commit.message.full=Update Spring
+ git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
+ git.commit.message.short=Update Spring
+ git.commit.user.name=Dave Syer
+ git.build.user.name=Dave Syer
+ git.build.user.email=dsyer@vmware.com
+ git.branch=develop
+ git.commit.time=2013-04-24T08\\:42\\:13+0100
+ git.build.time=2013-05-23T09\\:26\\:42+0100
+ """)
@SuppressWarnings("unchecked")
void gitFullDetailsAlwaysPresent() {
this.contextRunner.withPropertyValues("VCAP_APPLICATION:---").run((context) -> {
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryInfoEndpointWebExtensionTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryInfoEndpointWebExtensionTests.java
index e8cebbf1dd..ab9b5800c2 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryInfoEndpointWebExtensionTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/CloudFoundryInfoEndpointWebExtensionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -37,6 +37,7 @@ import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfigu
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -59,6 +60,21 @@ class CloudFoundryInfoEndpointWebExtensionTests {
HealthEndpointAutoConfiguration.class, CloudFoundryActuatorAutoConfiguration.class));
@Test
+ @WithResource(name = "git.properties", content = """
+ #Generated by Git-Commit-Id-Plugin
+ #Thu May 23 09:26:42 BST 2013
+ git.commit.id.abbrev=e02a4f3
+ git.commit.user.email=dsyer@vmware.com
+ git.commit.message.full=Update Spring
+ git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
+ git.commit.message.short=Update Spring
+ git.commit.user.name=Dave Syer
+ git.build.user.name=Dave Syer
+ git.build.user.email=dsyer@vmware.com
+ git.branch=develop
+ git.commit.time=2013-04-24T08\\:42\\:13+0100
+ git.build.time=2013-05-23T09\\:26\\:42+0100
+ """)
@SuppressWarnings("unchecked")
void gitFullDetailsAlwaysPresent() {
this.contextRunner.run((context) -> {
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java
index 6d7f0cf019..edaca1f623 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/SkipSslVerificationHttpRequestFactoryTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -21,6 +21,7 @@ import javax.net.ssl.SSLHandshakeException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
import org.springframework.boot.testsupport.web.servlet.ExampleServlet;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.server.Ssl;
@@ -49,6 +50,7 @@ class SkipSslVerificationHttpRequestFactoryTests {
}
@Test
+ @WithPackageResources("test.jks")
void restCallToSelfSignedServerShouldNotThrowSslException() {
String httpsUrl = getHttpsUrl();
SkipSslVerificationHttpRequestFactory requestFactory = new SkipSslVerificationHttpRequestFactory();
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java
index 6f41357d8a..ac4fad875f 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/FlywayEndpointDocumentationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -34,6 +34,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.restdocs.payload.FieldDescriptor;
+import org.springframework.test.context.TestPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
@@ -44,6 +45,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
*
* @author Andy Wilkinson
*/
+@TestPropertySource(
+ properties = "spring.flyway.locations=classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation")
class FlywayEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java
index 042e9e1e03..b77987076b 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/LiquibaseEndpointDocumentationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -31,6 +31,7 @@ import org.springframework.context.annotation.Import;
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation;
import org.springframework.restdocs.payload.FieldDescriptor;
import org.springframework.restdocs.payload.JsonFieldType;
+import org.springframework.test.context.TestPropertySource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
@@ -41,6 +42,8 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.response
*
* @author Andy Wilkinson
*/
+@TestPropertySource(
+ properties = "spring.liquibase.change-log=classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/db.changelog-master.yaml")
class LiquibaseEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Test
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SbomEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SbomEndpointDocumentationTests.java
index 5fb4e5b541..8597424a2f 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SbomEndpointDocumentationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/SbomEndpointDocumentationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -58,7 +58,9 @@ class SbomEndpointDocumentationTests extends MockMvcEndpointDocumentationTests {
@Bean
SbomProperties sbomProperties() {
SbomProperties properties = new SbomProperties();
- properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ properties.getApplication()
+ .setLocation(
+ "classpath:org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/cyclonedx.json");
return properties;
}
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java
index 7101dd9522..2c0cad8eeb 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -26,6 +26,7 @@ import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -34,6 +35,20 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dmytro Nosan
*/
+@WithResource(name = "hazelcast.xml", content = """
+
+
+
+
+
+
+
+
+
+ """)
class HazelcastHealthContributorAutoConfigurationIntegrationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java
index 73ed857e17..02a8f55a46 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/hazelcast/HazelcastHealthContributorAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -23,6 +23,7 @@ import org.springframework.boot.actuate.hazelcast.HazelcastHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,6 +32,20 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dmytro Nosan
*/
+@WithResource(name = "hazelcast.xml", content = """
+
+
+
+
+
+
+
+
+
+ """)
class HazelcastHealthContributorAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java
index fff5efec03..fcbeb3adc6 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/orm/jpa/HibernateMetricsAutoConfigurationTests.java
@@ -41,6 +41,7 @@ import org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConf
import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
@@ -138,6 +139,17 @@ class HibernateMetricsAutoConfigurationTests {
}
@Test
+ @WithResource(name = "city-schema.sql", content = """
+ CREATE TABLE CITY (
+ id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
+ name VARCHAR(30),
+ state VARCHAR(30),
+ country VARCHAR(30),
+ map VARCHAR(30)
+ );
+ """)
+ @WithResource(name = "city-data.sql",
+ content = "INSERT INTO CITY (ID, NAME, STATE, COUNTRY, MAP) values (2000, 'Washington', 'DC', 'US', 'Google');")
void entityManagerFactoryInstrumentationDoesNotDeadlockWithDeferredInitialization() {
this.contextRunner
.withPropertyValues("spring.jpa.properties.hibernate.generate_statistics:true",
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java
index 0e8437a192..23adfa9fa0 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -31,6 +31,7 @@ import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactor
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
import org.springframework.boot.web.embedded.jetty.JettyReactiveWebServerFactory;
import org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory;
import org.springframework.boot.web.reactive.context.AnnotationConfigReactiveWebServerApplicationContext;
@@ -132,13 +133,14 @@ class JettyMetricsAutoConfigurationTests {
}
@Test
+ @WithPackageResources("test.jks")
void autoConfiguresSslHandshakeMetricsWithEmbeddedServletJetty() {
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
ServletWebServerFactoryAutoConfiguration.class))
.withUserConfiguration(ServletWebServerConfiguration.class, MeterRegistryConfiguration.class)
- .withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
- "server.ssl.key-store-password: secret", "server.ssl.key-password: password")
+ .withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
+ "server.ssl.key-store-password=secret", "server.ssl.key-password=password")
.run((context) -> {
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class);
@@ -148,13 +150,14 @@ class JettyMetricsAutoConfigurationTests {
}
@Test
+ @WithPackageResources("test.jks")
void autoConfiguresSslHandshakeMetricsWithEmbeddedReactiveJetty() {
new ReactiveWebApplicationContextRunner(AnnotationConfigReactiveWebServerApplicationContext::new)
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
ReactiveWebServerFactoryAutoConfiguration.class))
.withUserConfiguration(ReactiveWebServerConfiguration.class, MeterRegistryConfiguration.class)
- .withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
- "server.ssl.key-store-password: secret", "server.ssl.key-password: password")
+ .withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
+ "server.ssl.key-store-password=secret", "server.ssl.key-password=password")
.run((context) -> {
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
SimpleMeterRegistry registry = context.getBean(SimpleMeterRegistry.class);
@@ -163,14 +166,15 @@ class JettyMetricsAutoConfigurationTests {
}
@Test
+ @WithPackageResources("test.jks")
void allowsCustomJettySslHandshakeMetricsBinderToBeUsed() {
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
.withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class,
ServletWebServerFactoryAutoConfiguration.class))
.withUserConfiguration(ServletWebServerConfiguration.class, CustomJettySslHandshakeMetricsBinder.class,
MeterRegistryConfiguration.class)
- .withPropertyValues("server.ssl.enabled: true", "server.ssl.key-store: src/test/resources/test.jks",
- "server.ssl.key-store-password: secret", "server.ssl.key-password: password")
+ .withPropertyValues("server.ssl.enabled=true", "server.ssl.key-store=classpath:test.jks",
+ "server.ssl.key-store-password=secret", "server.ssl.key-password=password")
.run((context) -> {
context.publishEvent(createApplicationStartedEvent(context.getSourceApplicationContext()));
assertThat(context).hasSingleBean(JettySslHandshakeMetricsBinder.class)
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java
index b60d93ee2d..4693c86468 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/security/servlet/ManagementWebSecurityAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -37,6 +37,7 @@ import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguratio
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.assertj.AssertableWebApplicationContext;
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
import org.springframework.boot.web.context.WebServerApplicationContext;
import org.springframework.boot.web.server.WebServer;
import org.springframework.boot.web.servlet.context.AnnotationConfigServletWebApplicationContext;
@@ -143,13 +144,14 @@ class ManagementWebSecurityAutoConfigurationTests {
}
@Test
+ @WithPackageResources("saml-certificate")
void backOffIfSaml2RelyingPartyAutoConfigurationPresent() {
this.contextRunner.withConfiguration(AutoConfigurations.of(Saml2RelyingPartyAutoConfiguration.class))
.withPropertyValues(
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.url=https://simplesaml-for-spring-saml/SSOService.php",
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.single-sign-on.sign-request=false",
"spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.entity-id=https://simplesaml-for-spring-saml.cfapps.io/saml2/idp/metadata.php",
- "spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.verification.credentials[0].certificate-location=classpath:saml/certificate-location")
+ "spring.security.saml2.relyingparty.registration.simplesamlphp.assertingparty.verification.credentials[0].certificate-location=classpath:saml-certificate")
.run((context) -> assertThat(context).doesNotHaveBean(ManagementWebSecurityAutoConfiguration.class)
.doesNotHaveBean(MANAGEMENT_SECURITY_FILTER_CHAIN_BEAN));
}
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthContributorAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthContributorAutoConfigurationTests.java
index d122d5041a..6fd09acbdb 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthContributorAutoConfigurationTests.java
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/ssl/SslHealthContributorAutoConfigurationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -32,6 +32,7 @@ import org.springframework.boot.info.SslInfo;
import org.springframework.boot.info.SslInfo.CertificateChainInfo;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithPackageResources;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -42,6 +43,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Jonatan Ivanov
*/
+@WithPackageResources("test.jks")
class SslHealthContributorAutoConfigurationTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/actuator-docs-index.html b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/actuator-docs-index.html
deleted file mode 100644
index 8b13789179..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/actuator-docs-index.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-data.sql b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-data.sql
deleted file mode 100644
index eb08623b4c..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-data.sql
+++ /dev/null
@@ -1 +0,0 @@
-INSERT INTO CITY (ID, NAME, STATE, COUNTRY, MAP) values (2000, 'Washington', 'DC', 'US', 'Google');
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-schema.sql b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-schema.sql
deleted file mode 100644
index b2a4112add..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/city-schema.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE CITY (
- id INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
- name VARCHAR(30),
- state VARCHAR(30),
- country VARCHAR(30),
- map VARCHAR(30)
-);
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/create-custom-schema.sql b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/create-custom-schema.sql
deleted file mode 100644
index 469b79ad89..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/create-custom-schema.sql
+++ /dev/null
@@ -1 +0,0 @@
-CREATE SCHEMA CUSTOMSCHEMA;
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/git.properties b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/git.properties
deleted file mode 100644
index d88056068a..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/git.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-#Generated by Git-Commit-Id-Plugin
-#Thu May 23 09:26:42 BST 2013
-git.commit.id.abbrev=e02a4f3
-git.commit.user.email=dsyer@vmware.com
-git.commit.message.full=Update Spring
-git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
-git.commit.message.short=Update Spring
-git.commit.user.name=Dave Syer
-git.build.user.name=Dave Syer
-git.build.user.email=dsyer@vmware.com
-git.branch=develop
-git.commit.time=2013-04-24T08\:42\:13+0100
-git.build.time=2013-05-23T09\:26\:42+0100
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml
deleted file mode 100644
index 566f53e3a1..0000000000
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/hazelcast.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/test.jks b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/test.jks
similarity index 100%
rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/test.jks
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/test.jks
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/migration/V1__init.sql b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/V1__init.sql
similarity index 100%
rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/migration/V1__init.sql
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/V1__init.sql
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/sbom/cyclonedx.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/cyclonedx.json
similarity index 100%
rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/sbom/cyclonedx.json
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/cyclonedx.json
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/changelog/db.changelog-master.yaml b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/db.changelog-master.yaml
similarity index 100%
rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/db/changelog/db.changelog-master.yaml
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/db.changelog-master.yaml
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/test.jks b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/test.jks
similarity index 100%
rename from spring-boot-project/spring-boot-actuator/src/test/resources/test.jks
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/test.jks
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/saml/certificate-location b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/security/servlet/saml-certificate
similarity index 100%
rename from spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/saml/certificate-location
rename to spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/security/servlet/saml-certificate
diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/ssl/test.jks b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/ssl/test.jks
new file mode 100644
index 0000000000..cc0d7081c2
Binary files /dev/null and b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/resources/org/springframework/boot/actuate/autoconfigure/ssl/test.jks differ
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java
index 4a892135a6..191d83439b 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/flyway/FlywayEndpointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,6 +37,9 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Andy Wilkinson
* @author Phillip Webb
*/
+@WithResource(name = "db/migration/V1__init.sql", content = "DROP TABLE IF EXISTS TEST;")
+@WithResource(name = "db/migration/V2__update.sql", content = "DROP TABLE IF EXISTS TEST;")
+@WithResource(name = "db/migration/V3__update.sql", content = "DROP TABLE IF EXISTS TEST;")
class FlywayEndpointTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
index d478843988..c2be016125 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/hazelcast/HazelcastHealthIndicatorTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -25,6 +25,7 @@ import org.springframework.boot.actuate.health.Status;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
@@ -40,6 +41,21 @@ import static org.mockito.Mockito.mock;
class HazelcastHealthIndicatorTests {
@Test
+ @WithResource(name = "hazelcast.xml", content = """
+
+ actuator-hazelcast
+
+
+
+
+
+
+
+
+ """)
void hazelcastUp() {
new ApplicationContextRunner().withConfiguration(AutoConfigurations.of(HazelcastAutoConfiguration.class))
.withPropertyValues("spring.hazelcast.config=hazelcast.xml")
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java
index c0f6900f1a..02ebb20d37 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/liquibase/LiquibaseEndpointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2023 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -35,6 +35,7 @@ import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer;
import org.springframework.boot.sql.init.DatabaseInitializationSettings;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -50,6 +51,12 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Stephane Nicoll
* @author Leo Li
*/
+@WithResource(name = "db/changelog/db.changelog-master.yaml", content = """
+ databaseChangeLog:
+ - changeSet:
+ id: 1
+ author: test
+ """)
class LiquibaseEndpointTests {
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
@@ -83,6 +90,7 @@ class LiquibaseEndpointTests {
}
@Test
+ @WithResource(name = "db/create-custom-schema.sql", content = "CREATE SCHEMA CUSTOMSCHEMA;")
void invokeWithCustomSchema() {
this.contextRunner.withUserConfiguration(Config.class, DataSourceWithSchemaConfiguration.class)
.withPropertyValues("spring.liquibase.default-schema=CUSTOMSCHEMA")
@@ -122,6 +130,12 @@ class LiquibaseEndpointTests {
}
@Test
+ @WithResource(name = "db/changelog/db.changelog-master-backup.yaml", content = """
+ databaseChangeLog:
+ - changeSet:
+ id: 1
+ author: test
+ """)
void whenMultipleLiquibaseBeansArePresentChangeSetsAreCorrectlyReportedForEachBean() {
this.contextRunner.withUserConfiguration(Config.class, MultipleDataSourceLiquibaseConfiguration.class)
.run((context) -> {
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointCycloneDxWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointCycloneDxWebIntegrationTests.java
index 85e5b12f19..371a9542a2 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointCycloneDxWebIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointCycloneDxWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -51,7 +51,7 @@ class SbomEndpointCycloneDxWebIntegrationTests {
@Bean
SbomProperties sbomProperties() {
SbomProperties properties = new SbomProperties();
- properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
return properties;
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSpdxWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSpdxWebIntegrationTests.java
index 264e8cd05d..4e8eba326f 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSpdxWebIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSpdxWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -51,7 +51,7 @@ class SbomEndpointSpdxWebIntegrationTests {
@Bean
SbomProperties sbomProperties() {
SbomProperties properties = new SbomProperties();
- properties.getApplication().setLocation("classpath:sbom/spdx.json");
+ properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/spdx.json");
return properties;
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSyftWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSyftWebIntegrationTests.java
index 0c6469322d..6ed52ec4fd 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSyftWebIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointSyftWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -51,7 +51,7 @@ class SbomEndpointSyftWebIntegrationTests {
@Bean
SbomProperties sbomProperties() {
SbomProperties properties = new SbomProperties();
- properties.getApplication().setLocation("classpath:sbom/syft.json");
+ properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/syft.json");
return properties;
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointTests.java
index f4c724d690..63f3fd8598 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -48,9 +48,11 @@ class SbomEndpointTests {
@Test
void shouldListSboms() {
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
- this.properties.getAdditional().put("alpha", sbom("classpath:sbom/cyclonedx.json"));
- this.properties.getAdditional().put("beta", sbom("classpath:sbom/cyclonedx.json"));
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
+ this.properties.getAdditional()
+ .put("alpha", sbom("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json"));
+ this.properties.getAdditional()
+ .put("beta", sbom("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json"));
Sboms sboms = createEndpoint().sboms();
assertThat(sboms.ids()).containsExactly("alpha", "application", "beta");
}
@@ -58,15 +60,16 @@ class SbomEndpointTests {
@Test
void shouldFailIfDuplicateSbomIdIsRegistered() {
// This adds an SBOM with id 'application'
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
- this.properties.getAdditional().put("application", sbom("classpath:sbom/cyclonedx.json"));
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
+ this.properties.getAdditional()
+ .put("application", sbom("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json"));
assertThatIllegalStateException().isThrownBy(this::createEndpoint)
.withMessage("Duplicate SBOM registration with id 'application'");
}
@Test
void shouldUseLocationFromProperties() throws IOException {
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
String content = createEndpoint().sbom("application").getContentAsString(StandardCharsets.UTF_8);
assertThat(content).contains("\"bomFormat\" : \"CycloneDX\"");
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebExtensionTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebExtensionTests.java
index 95831aacfd..03701f2f0e 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebExtensionTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebExtensionTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -30,6 +30,7 @@ import org.junit.jupiter.params.provider.EnumSource.Mode;
import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
import org.springframework.boot.actuate.sbom.SbomEndpointWebExtension.SbomType;
import org.springframework.boot.actuate.sbom.SbomProperties.Sbom;
+import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.http.MediaType;
@@ -53,7 +54,7 @@ class SbomEndpointWebExtensionTests {
@Test
void shouldReturnHttpOk() {
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
WebEndpointResponse response = createWebExtension().sbom("application");
assertThat(response.getStatus()).isEqualTo(200);
}
@@ -66,26 +67,27 @@ class SbomEndpointWebExtensionTests {
@Test
void shouldAutoDetectContentTypeForCycloneDx() {
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
WebEndpointResponse response = createWebExtension().sbom("application");
assertThat(response.getContentType()).isEqualTo(MimeType.valueOf("application/vnd.cyclonedx+json"));
}
@Test
void shouldAutoDetectContentTypeForSpdx() {
- this.properties.getApplication().setLocation("classpath:sbom/spdx.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/spdx.json");
WebEndpointResponse response = createWebExtension().sbom("application");
assertThat(response.getContentType()).isEqualTo(MimeType.valueOf("application/spdx+json"));
}
@Test
void shouldAutoDetectContentTypeForSyft() {
- this.properties.getApplication().setLocation("classpath:sbom/syft.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/syft.json");
WebEndpointResponse response = createWebExtension().sbom("application");
assertThat(response.getContentType()).isEqualTo(MimeType.valueOf("application/vnd.syft+json"));
}
@Test
+ @WithResource(name = "git.properties", content = "git.commit.id.abbrev=e02a4f3")
void shouldSupportUnknownFiles() {
this.properties.getApplication().setLocation("classpath:git.properties");
WebEndpointResponse response = createWebExtension().sbom("application");
@@ -94,7 +96,7 @@ class SbomEndpointWebExtensionTests {
@Test
void shouldUseContentTypeIfSet() {
- this.properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ this.properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
this.properties.getApplication().setMediaType(MimeType.valueOf("text/plain"));
WebEndpointResponse response = createWebExtension().sbom("application");
assertThat(response.getContentType()).isEqualTo(MimeType.valueOf("text/plain"));
@@ -103,7 +105,8 @@ class SbomEndpointWebExtensionTests {
@Test
void shouldUseContentTypeForAdditionalSbomsIfSet() {
this.properties.getAdditional()
- .put("alpha", sbom("classpath:sbom/cyclonedx.json", MediaType.valueOf("text/plain")));
+ .put("alpha", sbom("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json",
+ MediaType.valueOf("text/plain")));
WebEndpointResponse response = createWebExtension().sbom("alpha");
assertThat(response.getContentType()).isEqualTo(MimeType.valueOf("text/plain"));
}
@@ -120,9 +123,9 @@ class SbomEndpointWebExtensionTests {
private String getSbomContent(SbomType type) throws IOException {
return switch (type) {
- case CYCLONE_DX -> readResource("/sbom/cyclonedx.json");
- case SPDX -> readResource("/sbom/spdx.json");
- case SYFT -> readResource("/sbom/syft.json");
+ case CYCLONE_DX -> readResource("cyclonedx.json");
+ case SPDX -> readResource("spdx.json");
+ case SYFT -> readResource("syft.json");
case UNKNOWN -> throw new IllegalArgumentException("UNKNOWN is not supported");
};
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebIntegrationTests.java
index 77b4ecdfc6..b41e9e14bc 100644
--- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebIntegrationTests.java
+++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/sbom/SbomEndpointWebIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2024 the original author or authors.
+ * Copyright 2012-2025 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.
@@ -54,7 +54,7 @@ class SbomEndpointWebIntegrationTests {
@Bean
SbomProperties sbomProperties() {
SbomProperties properties = new SbomProperties();
- properties.getApplication().setLocation("classpath:sbom/cyclonedx.json");
+ properties.getApplication().setLocation("classpath:org/springframework/boot/actuate/sbom/cyclonedx.json");
return properties;
}
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/actuator-docs-index.html b/spring-boot-project/spring-boot-actuator/src/test/resources/actuator-docs-index.html
deleted file mode 100644
index 8b13789179..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/actuator-docs-index.html
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master-backup.yaml b/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master-backup.yaml
deleted file mode 100644
index a3a19b43af..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master-backup.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-databaseChangeLog:
- - changeSet:
- id: 1
- author: leoli
- changes:
- - createTable:
- tableName: customerbackup
- columns:
- - column:
- name: id
- type: int
- autoIncrement: true
- constraints:
- primaryKey: true
- nullable: false
- - column:
- name: name
- type: varchar(50)
- constraints:
- nullable: false
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml b/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml
deleted file mode 100644
index 134b17b543..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/changelog/db.changelog-master.yaml
+++ /dev/null
@@ -1,20 +0,0 @@
-databaseChangeLog:
- - changeSet:
- id: 1
- author: marceloverdijk
- changes:
- - createTable:
- tableName: customer
- columns:
- - column:
- name: id
- type: int
- autoIncrement: true
- constraints:
- primaryKey: true
- nullable: false
- - column:
- name: name
- type: varchar(50)
- constraints:
- nullable: false
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/create-custom-schema.sql b/spring-boot-project/spring-boot-actuator/src/test/resources/db/create-custom-schema.sql
deleted file mode 100644
index 469b79ad89..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/create-custom-schema.sql
+++ /dev/null
@@ -1 +0,0 @@
-CREATE SCHEMA CUSTOMSCHEMA;
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V1__init.sql b/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V1__init.sql
deleted file mode 100644
index 867c7c24f5..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V1__init.sql
+++ /dev/null
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS TEST;
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V2__update.sql b/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V2__update.sql
deleted file mode 100644
index 867c7c24f5..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V2__update.sql
+++ /dev/null
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS TEST;
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V3__update.sql b/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V3__update.sql
deleted file mode 100644
index 867c7c24f5..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/db/migration/V3__update.sql
+++ /dev/null
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS TEST;
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/git.properties b/spring-boot-project/spring-boot-actuator/src/test/resources/git.properties
deleted file mode 100644
index d88056068a..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/git.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-#Generated by Git-Commit-Id-Plugin
-#Thu May 23 09:26:42 BST 2013
-git.commit.id.abbrev=e02a4f3
-git.commit.user.email=dsyer@vmware.com
-git.commit.message.full=Update Spring
-git.commit.id=e02a4f3b6f452cdbf6dd311f1362679eb4c31ced
-git.commit.message.short=Update Spring
-git.commit.user.name=Dave Syer
-git.build.user.name=Dave Syer
-git.build.user.email=dsyer@vmware.com
-git.branch=develop
-git.commit.time=2013-04-24T08\:42\:13+0100
-git.build.time=2013-05-23T09\:26\:42+0100
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml b/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml
deleted file mode 100644
index d01639965c..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/hazelcast.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
- actuator-hazelcast
-
-
-
-
-
-
-
-
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/log4j2-test.xml b/spring-boot-project/spring-boot-actuator/src/test/resources/log4j2-test.xml
deleted file mode 100644
index 8c0f7f4652..0000000000
--- a/spring-boot-project/spring-boot-actuator/src/test/resources/log4j2-test.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
- %xwEx
- %5p
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/sbom/cyclonedx.json b/spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/cyclonedx.json
similarity index 100%
rename from spring-boot-project/spring-boot-actuator/src/test/resources/sbom/cyclonedx.json
rename to spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/cyclonedx.json
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/sbom/spdx.json b/spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/spdx.json
similarity index 100%
rename from spring-boot-project/spring-boot-actuator/src/test/resources/sbom/spdx.json
rename to spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/spdx.json
diff --git a/spring-boot-project/spring-boot-actuator/src/test/resources/sbom/syft.json b/spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/syft.json
similarity index 100%
rename from spring-boot-project/spring-boot-actuator/src/test/resources/sbom/syft.json
rename to spring-boot-project/spring-boot-actuator/src/test/resources/org/springframework/boot/actuate/sbom/syft.json