Skip to content

Commit efc7612

Browse files
update for spring boot 3.5.7 (#21)
* - Refactor Gradle dependencies to use version catalogs for consistency and maintainability. - Add and improve class-level Javadoc for better documentation and clarity of purpose. - Update Gradle wrapper to version 8.10.2 for compatibility with newer tools. - Update dependencies for compatibility with Spring Boot 3.5.7 * Removed some erroneously committed stuff
1 parent d6a88a0 commit efc7612

File tree

36 files changed

+154
-21
lines changed

36 files changed

+154
-21
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ gradle-app.setting
5252
# gradle/wrapper/gradle-wrapper.properties
5353

5454
# End of https://www.gitignore.io/api/gradle
55-

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ subprojects {
4444
if (!name.endsWith("-client")) {
4545
dependencies {
4646
"implementation"(libs.micronaut.testresources.testcontainers)
47+
"compileOnly"(libs.micronaut.core)
4748
"implementation"(libs.testcontainers.junit4.mock)
4849
}
4950
}

gradle/libs.versions.toml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
[versions]
2-
micronaut-testresources = "1.2.5"
3-
spring-boot = "3.0.5"
4-
junit = "5.8.1"
2+
micronaut-testresources = "1.2.6"
3+
spring-boot = "3.5.7"
4+
quarkus-junit-mock = "3.30.3"
5+
micronaut = "3.8.7"
6+
7+
junit = "5.9.1"
8+
assertj = "3.27.6"
9+
azurite = "5.24.1"
510

611
[libraries]
712

813
micronaut-testresources-client = { module = "io.micronaut.testresources:micronaut-test-resources-client", version.ref = "micronaut-testresources" }
914
micronaut-testresources-testcontainers = { module = "io.micronaut.testresources:micronaut-test-resources-testcontainers", version.ref = "micronaut-testresources" }
15+
micronaut-core = { module = "io.micronaut:micronaut-core", version.ref = "micronaut" }
16+
micronaut-http-client = { module = "io.micronaut:micronaut-http-client", version.ref = "micronaut" }
1017

1118
spring-boot = { module = "org.springframework.boot:spring-boot", version.ref = "spring-boot" }
12-
spring-bootbom = { module = "org.springframework.boot:spring-boot-dependencies", version.ref = "spring-boot" }
1319

1420
jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
1521
jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }
1622

17-
assertj = { module = "org.assertj:assertj-core", version = "3.23.1" }
18-
testcontainers-elasticsearch = { module = "org.testcontainers:elasticsearch", version = "" }
19-
testcontainers-junit4-mock = { module = "io.quarkus:quarkus-junit4-mock", version = "2.9.2.Final" }
23+
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
24+
testcontainers-elasticsearch = { module = "org.testcontainers:elasticsearch" }
25+
testcontainers-jdbc = { module = "org.testcontainers:jdbc" }
26+
testcontainers-mariadb = { module = "org.testcontainers:mariadb" }
27+
testcontainers-mssqlserver = { module = "org.testcontainers:mssqlserver" }
28+
testcontainers-postgresql = { module = "org.testcontainers:postgresql" }
29+
testcontainers-rabbitmq = { module = "org.testcontainers:rabbitmq" }
30+
testcontainers-junit4-mock = { module = "io.quarkus:quarkus-junit4-mock", version.ref = "quarkus-junit-mock" }
31+
32+
spring-cloud-azure-starter-storage-blob = { module = "com.azure.spring:spring-cloud-azure-starter-storage-blob", version.ref = "azurite" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

springboot-testresources-azurite/src/main/java/io/cloudflight/testresources/springboot/azurite/AzuriteTestResourceProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
import java.util.*;
88

9+
/**
10+
* Test container provider for Azure Blob Storage Emulator.
11+
*/
912
public class AzuriteTestResourceProvider extends AbstractTestContainersProvider<GenericContainer<?>> {
1013

1114
private static final String PREFIX = "spring.cloud.azure.storage.blob.";

springboot-testresources-client/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ description = "Client library for Spring Boot integration tests to connect to th
22

33
dependencies {
44
implementation(libs.micronaut.testresources.client)
5+
implementation(libs.micronaut.http.client)
56

67
compileOnly(libs.spring.boot)
78
}

springboot-testresources-client/src/main/java/io/cloudflight/testresources/springboot/client/TestResourcesEnvironmentPostProcessor.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@
1111

1212
import java.util.Optional;
1313

14+
/**
15+
* The TestResourcesEnvironmentPostProcessor class is a Spring EnvironmentPostProcessor
16+
* that integrates with the test resources service and modifies the application's
17+
* environment configuration accordingly.
18+
*
19+
* This processor attempts to instantiate a TestResourcesClient from system
20+
* properties using the {@link TestResourcesClientFactory#fromSystemProperties()}
21+
* method. If successful, it adds a custom {@link TestResourcesPropertySource}
22+
* to the environment's property sources to resolve properties from the test
23+
* resources service.
24+
*
25+
* If the TestResourcesClient cannot be created, an ApplicationContextException
26+
* is thrown indicating that the TestResources service is unavailable, and the
27+
* Test-Resources Build plugin for Maven or Gradle may not be active.
28+
*
29+
* The processor is set to execute with the lowest precedence to ensure it interacts
30+
* with an already configured environment.
31+
*/
1432
@Order(Ordered.LOWEST_PRECEDENCE)
1533
public class TestResourcesEnvironmentPostProcessor implements EnvironmentPostProcessor {
1634
@Override

springboot-testresources-client/src/main/java/io/cloudflight/testresources/springboot/client/TestResourcesPropertySource.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@
1111

1212
import static java.util.Collections.emptyMap;
1313

14+
/**
15+
* Property source that exposes the test resources configuration as properties.
16+
*/
1417
public class TestResourcesPropertySource extends PropertySource<TestResourcesClient> {
1518

1619
private static final String NAME = "testresources";
1720
private static final String TEST_RESOURCES_PROPERTY_PREFIX = "test-resources.";
1821
private final ConfigurableEnvironment environment;
1922
private static Map<String, Object> testResourcesConfiguration;
2023

24+
/**
25+
* Constructor.
26+
* @param client .
27+
* @param environment .
28+
*/
2129
public TestResourcesPropertySource(TestResourcesClient client, ConfigurableEnvironment environment) {
2230
super(NAME, client);
2331
this.environment = environment;

springboot-testresources-client/src/main/java/io/cloudflight/testresources/springboot/client/micronaut/TestResourcesClientFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
*/
1919
public class TestResourcesClientFactory {
2020

21+
/**
22+
* Tries to create a {@link TestResourcesClient} from the system properties.
23+
* @return The {@link TestResourcesClient} if it could be created, otherwise {@link Optional#empty()}
24+
*/
2125
public static Optional<TestResourcesClient> fromSystemProperties() {
2226
String serverUri = System.getProperty(ConfigFinder.systemPropertyNameOf(TestResourcesClient.SERVER_URI));
2327
if (serverUri != null) {

springboot-testresources-elasticsearch/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
description = "Spring Boot TestResourceProvider for Elasticsearc"
33

44
dependencies {
5-
implementation("org.testcontainers:elasticsearch")
5+
implementation(libs.testcontainers.elasticsearch)
66
}

0 commit comments

Comments
 (0)