From 0e3cca2d6f825b14b8cdbb2d01901bd89e69b76c Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Mon, 27 May 2024 14:13:37 +0200 Subject: [PATCH] Polish --- .../ElasticsearchProjectGenerationConfiguration.java | 2 +- .../mysql/MysqlProjectGenerationConfiguration.java | 2 +- .../oracle/OracleProjectGenerationConfiguration.java | 6 ++++-- .../SpringAmqpProjectGenerationConfiguration.java | 2 +- .../SpringCloudProjectGenerationConfiguration.java | 12 ++++++------ .../SpringKafkaProjectGenerationConfiguration.java | 7 ++++--- .../SqlServerProjectGenerationConfiguration.java | 2 +- ...TestcontainersProjectGenerationConfiguration.java | 2 -- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/elasticsearch/ElasticsearchProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/elasticsearch/ElasticsearchProjectGenerationConfiguration.java index 18a96d257e..1e74daf882 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/elasticsearch/ElasticsearchProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/elasticsearch/ElasticsearchProjectGenerationConfiguration.java @@ -35,7 +35,7 @@ @ConditionalOnRequestedDependency("data-elasticsearch") class ElasticsearchProjectGenerationConfiguration { - private static String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.elasticsearch.ElasticsearchContainer"; + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.elasticsearch.ElasticsearchContainer"; @Bean @ConditionalOnRequestedDependency("testcontainers") diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/mysql/MysqlProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/mysql/MysqlProjectGenerationConfiguration.java index 95a95520cf..49e35d8545 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/mysql/MysqlProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/mysql/MysqlProjectGenerationConfiguration.java @@ -35,7 +35,7 @@ @ConditionalOnRequestedDependency("mysql") class MysqlProjectGenerationConfiguration { - private static String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.MySQLContainer"; + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.MySQLContainer"; @Bean @ConditionalOnRequestedDependency("testcontainers") diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/oracle/OracleProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/oracle/OracleProjectGenerationConfiguration.java index db1f568ff4..ac7f70ec28 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/oracle/OracleProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/oracle/OracleProjectGenerationConfiguration.java @@ -35,12 +35,14 @@ @ConditionalOnRequestedDependency("oracle") class OracleProjectGenerationConfiguration { + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.oracle.OracleContainer"; + @Bean @ConditionalOnRequestedDependency("testcontainers") ServiceConnectionsCustomizer oracleServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) { return (serviceConnections) -> serviceResolver.doWith("oracleFree", - (service) -> serviceConnections.addServiceConnection(ServiceConnection.ofContainer("oracleFree", - service, "org.testcontainers.oracle.OracleContainer", false))); + (service) -> serviceConnections.addServiceConnection( + ServiceConnection.ofContainer("oracleFree", service, TESTCONTAINERS_CLASS_NAME, false))); } @Bean diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/springamqp/SpringAmqpProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/springamqp/SpringAmqpProjectGenerationConfiguration.java index 6c5a457f9f..29ccafce5c 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/springamqp/SpringAmqpProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/springamqp/SpringAmqpProjectGenerationConfiguration.java @@ -35,7 +35,7 @@ @ConditionalOnRequestedDependency("amqp") class SpringAmqpProjectGenerationConfiguration { - private static String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.RabbitMQContainer"; + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.RabbitMQContainer"; @Bean SpringRabbitTestBuildCustomizer springAmqpTestBuildCustomizer() { diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudProjectGenerationConfiguration.java index 27415f50b8..0c668f7f7f 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/springcloud/SpringCloudProjectGenerationConfiguration.java @@ -42,24 +42,24 @@ * @author Stephane Nicoll */ @ProjectGenerationConfiguration -public class SpringCloudProjectGenerationConfiguration { +class SpringCloudProjectGenerationConfiguration { private final InitializrMetadata metadata; private final ProjectDescription description; - public SpringCloudProjectGenerationConfiguration(InitializrMetadata metadata, ProjectDescription description) { + SpringCloudProjectGenerationConfiguration(InitializrMetadata metadata, ProjectDescription description) { this.metadata = metadata; this.description = description; } @Bean - public SpringCloudFunctionBuildCustomizer springCloudFunctionBuildCustomizer() { + SpringCloudFunctionBuildCustomizer springCloudFunctionBuildCustomizer() { return new SpringCloudFunctionBuildCustomizer(this.metadata, this.description); } @Bean - public SpringCloudStreamBuildCustomizer springCloudStreamBuildCustomizer() { + SpringCloudStreamBuildCustomizer springCloudStreamBuildCustomizer() { return new SpringCloudStreamBuildCustomizer(); } @@ -69,14 +69,14 @@ SpringCloudProjectVersionResolver springCloudProjectVersionResolver(MavenVersion } @Bean - public SpringCloudFunctionHelpDocumentCustomizer springCloudFunctionHelpDocumentCustomizer(Build build, + SpringCloudFunctionHelpDocumentCustomizer springCloudFunctionHelpDocumentCustomizer(Build build, MustacheTemplateRenderer templateRenderer, SpringCloudProjectVersionResolver versionResolver) { return new SpringCloudFunctionHelpDocumentCustomizer(build, this.description, templateRenderer, versionResolver); } @Bean - public SpringCloudCircuitBreakerBuildCustomizer springCloudCircuitBreakerBuildCustomizer() { + SpringCloudCircuitBreakerBuildCustomizer springCloudCircuitBreakerBuildCustomizer() { return new SpringCloudCircuitBreakerBuildCustomizer(this.metadata, this.description); } diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/springkafka/SpringKafkaProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/springkafka/SpringKafkaProjectGenerationConfiguration.java index af981eb215..d1b8c6a909 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/springkafka/SpringKafkaProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/springkafka/SpringKafkaProjectGenerationConfiguration.java @@ -33,6 +33,8 @@ @ConditionalOnRequestedDependency("kafka") class SpringKafkaProjectGenerationConfiguration { + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.KafkaContainer"; + @Bean SpringKafkaBuildCustomizer springKafkaBuildCustomizer() { return new SpringKafkaBuildCustomizer(); @@ -41,9 +43,8 @@ SpringKafkaBuildCustomizer springKafkaBuildCustomizer() { @Bean @ConditionalOnRequestedDependency("testcontainers") ServiceConnectionsCustomizer kafkaServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) { - return (serviceConnections) -> serviceResolver.doWith("kafka", - (service) -> serviceConnections.addServiceConnection(ServiceConnection.ofContainer("kafka", service, - "org.testcontainers.containers.KafkaContainer", false))); + return (serviceConnections) -> serviceResolver.doWith("kafka", (service) -> serviceConnections + .addServiceConnection(ServiceConnection.ofContainer("kafka", service, TESTCONTAINERS_CLASS_NAME, false))); } } diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/sqlserver/SqlServerProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/sqlserver/SqlServerProjectGenerationConfiguration.java index 50ad4fe5f1..1005a1d60b 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/sqlserver/SqlServerProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/sqlserver/SqlServerProjectGenerationConfiguration.java @@ -35,7 +35,7 @@ @ConditionalOnRequestedDependency("sqlserver") class SqlServerProjectGenerationConfiguration { - private static String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.MSSQLServerContainer"; + private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.MSSQLServerContainer"; @Bean @ConditionalOnRequestedDependency("testcontainers") diff --git a/start-site/src/main/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfiguration.java b/start-site/src/main/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfiguration.java index b3f59fa575..4cedcf17a6 100644 --- a/start-site/src/main/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfiguration.java +++ b/start-site/src/main/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfiguration.java @@ -20,7 +20,6 @@ import io.spring.initializr.generator.buildsystem.Dependency; import io.spring.initializr.generator.buildsystem.DependencyScope; import io.spring.initializr.generator.condition.ConditionalOnLanguage; -import io.spring.initializr.generator.condition.ConditionalOnPlatformVersion; import io.spring.initializr.generator.condition.ConditionalOnRequestedDependency; import io.spring.initializr.generator.io.IndentingWriterFactory; import io.spring.initializr.generator.language.groovy.GroovyLanguage; @@ -114,7 +113,6 @@ GroovyTestContainersApplicationCodeProjectContributor groovyTestContainersApplic @Bean @ConditionalOnLanguage(KotlinLanguage.ID) - @ConditionalOnPlatformVersion("3.1.1-SNAPSHOT") // https://github.com/spring-projects/spring-boot/issues/35756 KotlinTestContainersApplicationCodeProjectContributor kotlinTestContainersApplicationCodeProjectContributor( ServiceConnections serviceConnections) { return new KotlinTestContainersApplicationCodeProjectContributor(this.indentingWriterFactory,