Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed May 27, 2024
1 parent 730ab4f commit 0e3cca2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 0e3cca2

Please sign in to comment.