diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index aba6e33d..2d650ff9 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -233,11 +233,6 @@ zipkin-sender-urlconnection test - - io.awspring.cloud - spring-cloud-aws-starter-s3 - test - diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/AwsS3IntegrationTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/AwsS3IntegrationTests.java index 5f680281..b4aacb06 100644 --- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/AwsS3IntegrationTests.java +++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/AwsS3IntegrationTests.java @@ -18,7 +18,6 @@ package org.springframework.cloud.config.server; import java.io.IOException; -import io.awspring.cloud.autoconfigure.s3.S3AutoConfiguration; import org.json.JSONException; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -60,7 +59,7 @@ public class AwsS3IntegrationTests { @BeforeAll public static void startConfigServer() throws IOException, InterruptedException, JSONException { - server = SpringApplication.run(new Class[] { TestConfigServerApplication.class, S3AutoConfiguration.class }, + server = SpringApplication.run(new Class[] { TestConfigServerApplication.class }, new String[] { "--spring.config.name=server", "--spring.profiles.active=awss3", "--server.port=" + configServerPort, "--spring.cloud.config.server.awss3.endpoint=" @@ -73,14 +72,16 @@ public class AwsS3IntegrationTests { "--spring.cloud.aws.credentials.secret-key=" + localstack.getSecretKey(), "--spring.cloud.aws.region.static=" + localstack.getRegion() }); - s3Client = server.getBean(S3Client.class); - s3Client.createBucket((request) -> request.bucket("test-bucket")); - s3Client.putObject((request) -> request.bucket("test-bucket").key("data.txt"), - RequestBody.fromString("this is a test")); - s3Client.putObject((request) -> request.bucket("test-bucket").key("main/data.txt"), - RequestBody.fromString("this is a test in main")); - s3Client.putObject((request) -> request.bucket("test-bucket").key("application.properties"), - RequestBody.fromString("foo=1")); + if (server.containsBean(S3Client.class.getName())) { + s3Client = server.getBean(S3Client.class); + s3Client.createBucket((request) -> request.bucket("test-bucket")); + s3Client.putObject((request) -> request.bucket("test-bucket").key("data.txt"), + RequestBody.fromString("this is a test")); + s3Client.putObject((request) -> request.bucket("test-bucket").key("main/data.txt"), + RequestBody.fromString("this is a test in main")); + s3Client.putObject((request) -> request.bucket("test-bucket").key("application.properties"), + RequestBody.fromString("foo=1")); + } }