Skip to content

Commit

Permalink
Remove support for Spring Boot 3.2
Browse files Browse the repository at this point in the history
Closes gh-1643
  • Loading branch information
mhalbritter committed Nov 22, 2024
1 parent f0a5d23 commit b7a9b6c
Show file tree
Hide file tree
Showing 68 changed files with 418 additions and 655 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import io.spring.initializr.generator.spring.documentation.HelpDocument;
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;

/**
* A {@link HelpDocumentCustomizer} that adds reference links for Gradle.
Expand All @@ -33,8 +31,6 @@ class GradleBuildSystemHelpDocumentCustomizer implements HelpDocumentCustomizer

private static final String SPRING_BOOT_DOCS_URL = "https://docs.spring.io/spring-boot";

private static final VersionRange SPRING_BOOT_3_3_0_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0");

private final Version springBootVersion;

GradleBuildSystemHelpDocumentCustomizer(ProjectDescription description) {
Expand All @@ -50,16 +46,11 @@ public void customize(HelpDocument document) {
document.gettingStarted()
.addReferenceDocLink(generateReferenceGuideUrl(), "Spring Boot Gradle Plugin Reference Guide");
document.gettingStarted()
.addReferenceDocLink(
String
.format(generateReferenceGuideUrl() + (SPRING_BOOT_3_3_0_OR_LATER.match(this.springBootVersion)
? "/packaging-oci-image.html" : "#build-image"), this.springBootVersion),
"Create an OCI image");
.addReferenceDocLink(generateReferenceGuideUrl() + "/packaging-oci-image.html", "Create an OCI image");
}

private String generateReferenceGuideUrl() {
String baseUrlFormat = SPRING_BOOT_DOCS_URL + (SPRING_BOOT_3_3_0_OR_LATER.match(this.springBootVersion)
? "/%s/gradle-plugin" : "/docs/%s/gradle-plugin/reference/html/");
String baseUrlFormat = SPRING_BOOT_DOCS_URL + "/%s/gradle-plugin";
return baseUrlFormat.formatted(this.springBootVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import io.spring.initializr.generator.spring.documentation.HelpDocument;
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;

/**
* A {@link HelpDocumentCustomizer} that adds reference links for Apache Maven.
Expand All @@ -33,8 +31,6 @@ class MavenBuildSystemHelpDocumentCustomizer implements HelpDocumentCustomizer {

private static final String SPRING_BOOT_DOCS_URL = "https://docs.spring.io/spring-boot";

private static final VersionRange SPRING_BOOT_3_3_0_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0");

private final Version springBootVersion;

MavenBuildSystemHelpDocumentCustomizer(ProjectDescription description) {
Expand All @@ -47,14 +43,12 @@ public void customize(HelpDocument document) {
.addReferenceDocLink("https://maven.apache.org/guides/index.html", "Official Apache Maven documentation");
String referenceGuideUrl = generateReferenceGuideUrl();
document.gettingStarted().addReferenceDocLink(referenceGuideUrl, "Spring Boot Maven Plugin Reference Guide");
String buildImageSection = referenceGuideUrl
+ (SPRING_BOOT_3_3_0_OR_LATER.match(this.springBootVersion) ? "/build-image.html" : "#build-image");
String buildImageSection = referenceGuideUrl + "/build-image.html";
document.gettingStarted().addReferenceDocLink(buildImageSection, "Create an OCI image");
}

private String generateReferenceGuideUrl() {
String baseUrlFormat = SPRING_BOOT_DOCS_URL + (SPRING_BOOT_3_3_0_OR_LATER.match(this.springBootVersion)
? "/%s/maven-plugin" : "/docs/%s/maven-plugin/reference/html/");
String baseUrlFormat = SPRING_BOOT_DOCS_URL + "/%s/maven-plugin";
return baseUrlFormat.formatted(this.springBootVersion);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.spring.start.site.extension.dependency.activemq;

import io.spring.initializr.generator.condition.ConditionalOnPlatformVersion;
import io.spring.initializr.generator.condition.ConditionalOnRequestedDependency;
import io.spring.initializr.generator.project.ProjectGenerationConfiguration;
import io.spring.start.site.container.ComposeFileCustomizer;
Expand All @@ -38,15 +37,6 @@ public class ActiveMQProjectGenerationConfiguration {
private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.activemq.ActiveMQContainer";

@Bean
@ConditionalOnPlatformVersion("[3.2.0,3.3.0-M2)")
@ConditionalOnRequestedDependency("testcontainers")
ServiceConnectionsCustomizer activeMQServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) {
return (serviceConnections) -> serviceResolver.doWith("activeMQ", (service) -> serviceConnections
.addServiceConnection(ServiceConnection.ofGenericContainer("activeMQ", service, "symptoma/activemq")));
}

@Bean
@ConditionalOnPlatformVersion("3.3.0-M2")
@ConditionalOnRequestedDependency("testcontainers")
ServiceConnectionsCustomizer activeMQClassicServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) {
return (serviceConnections) -> serviceResolver.doWith("activeMQClassic",
Expand All @@ -55,15 +45,6 @@ ServiceConnectionsCustomizer activeMQClassicServiceConnectionsCustomizer(DockerS
}

@Bean
@ConditionalOnPlatformVersion("[3.2.0,3.3.0-M2)")
@ConditionalOnRequestedDependency("docker-compose")
ComposeFileCustomizer activeMQComposeFileCustomizer(DockerServiceResolver serviceResolver) {
return (composeFile) -> serviceResolver.doWith("activeMQ",
(service) -> composeFile.services().add("activemq", service));
}

@Bean
@ConditionalOnPlatformVersion("3.3.0-M2")
@ConditionalOnRequestedDependency("docker-compose")
ComposeFileCustomizer activeMQClassicComposeFileCustomizer(DockerServiceResolver serviceResolver) {
return (composeFile) -> serviceResolver.doWith("activeMQClassic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.spring.start.site.extension.dependency.activemq;

import io.spring.initializr.generator.condition.ConditionalOnPlatformVersion;
import io.spring.initializr.generator.condition.ConditionalOnRequestedDependency;
import io.spring.initializr.generator.project.ProjectGenerationConfiguration;
import io.spring.start.site.container.ComposeFileCustomizer;
Expand All @@ -38,15 +37,13 @@ public class ArtemisProjectGenerationConfiguration {
private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.activemq.ArtemisContainer";

@Bean
@ConditionalOnPlatformVersion("3.3.0-M2")
@ConditionalOnRequestedDependency("testcontainers")
ServiceConnectionsCustomizer artemisServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) {
return (serviceConnections) -> serviceResolver.doWith("artemis", (service) -> serviceConnections
.addServiceConnection(ServiceConnection.ofContainer("artemis", service, TESTCONTAINERS_CLASS_NAME, false)));
}

@Bean
@ConditionalOnPlatformVersion("3.3.0-M2")
@ConditionalOnRequestedDependency("docker-compose")
ComposeFileCustomizer artemisComposeFileCustomizer(DockerServiceResolver serviceResolver) {
return (composeFile) -> serviceResolver.doWith("artemis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import io.spring.initializr.generator.buildsystem.Build;
import io.spring.initializr.generator.buildsystem.DependencyContainer;
import io.spring.initializr.generator.buildsystem.DependencyScope;
import io.spring.initializr.generator.project.ProjectDescription;
import io.spring.initializr.generator.spring.build.BuildCustomizer;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;

/**
* Determine the appropriate Flyway dependency according to the database.
Expand All @@ -33,14 +30,6 @@
*/
class FlywayBuildCustomizer implements BuildCustomizer<Build> {

private static final VersionRange SPRING_BOOT_3_3_M3_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0-M3");

private final boolean isSpringBoot33OrLater;

FlywayBuildCustomizer(ProjectDescription projectDescription) {
this.isSpringBoot33OrLater = SPRING_BOOT_3_3_M3_OR_LATER.match(projectDescription.getPlatformVersion());
}

@Override
public void customize(Build build) {
DependencyContainer dependencies = build.dependencies();
Expand All @@ -53,22 +42,19 @@ public void customize(Build build) {
if (dependencies.has("oracle")) {
dependencies.add("flyway-oracle", "org.flywaydb", "flyway-database-oracle", DependencyScope.COMPILE);
}
if (this.isSpringBoot33OrLater) {
if (dependencies.has("db2")) {
dependencies.add("flyway-database-db2", "org.flywaydb", "flyway-database-db2", DependencyScope.COMPILE);
}
if (dependencies.has("derby")) {
dependencies.add("flyway-database-derby", "org.flywaydb", "flyway-database-derby",
DependencyScope.COMPILE);
}
if (dependencies.has("hsql")) {
dependencies.add("flyway-database-hsqldb", "org.flywaydb", "flyway-database-hsqldb",
DependencyScope.COMPILE);
}
if (dependencies.has("postgresql")) {
dependencies.add("flyway-database-postgresql", "org.flywaydb", "flyway-database-postgresql",
DependencyScope.COMPILE);
}
if (dependencies.has("db2")) {
dependencies.add("flyway-database-db2", "org.flywaydb", "flyway-database-db2", DependencyScope.COMPILE);
}
if (dependencies.has("derby")) {
dependencies.add("flyway-database-derby", "org.flywaydb", "flyway-database-derby", DependencyScope.COMPILE);
}
if (dependencies.has("hsql")) {
dependencies.add("flyway-database-hsqldb", "org.flywaydb", "flyway-database-hsqldb",
DependencyScope.COMPILE);
}
if (dependencies.has("postgresql")) {
dependencies.add("flyway-database-postgresql", "org.flywaydb", "flyway-database-postgresql",
DependencyScope.COMPILE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package io.spring.start.site.extension.dependency.flyway;

import io.spring.initializr.generator.condition.ConditionalOnRequestedDependency;
import io.spring.initializr.generator.project.ProjectDescription;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -37,8 +36,8 @@ FlywayProjectContributor flywayProjectContributor() {
}

@Bean
FlywayBuildCustomizer flywayBuildCustomizer(ProjectDescription projectDescription) {
return new FlywayBuildCustomizer(projectDescription);
FlywayBuildCustomizer flywayBuildCustomizer() {
return new FlywayBuildCustomizer();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import io.spring.initializr.generator.spring.documentation.HelpDocument;
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;
import io.spring.initializr.metadata.Dependency;
import io.spring.initializr.metadata.InitializrMetadata;

Expand All @@ -40,8 +38,6 @@
*/
class GraalVmHelpDocumentCustomizer implements HelpDocumentCustomizer {

private static final VersionRange SPRING_BOOT_3_3_0_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0");

private final InitializrMetadata metadata;

private final ProjectDescription description;
Expand All @@ -60,16 +56,12 @@ class GraalVmHelpDocumentCustomizer implements HelpDocumentCustomizer {
@Override
public void customize(HelpDocument document) {
document.gettingStarted()
.addReferenceDocLink(String.format(SPRING_BOOT_3_3_0_OR_LATER.match(this.platformVersion)
? "https://docs.spring.io/spring-boot/%s/reference/packaging/native-image/introducing-graalvm-native-images.html"
: "https://docs.spring.io/spring-boot/docs/%s/reference/html/native-image.html#native-image",
.addReferenceDocLink(String.format(
"https://docs.spring.io/spring-boot/%s/reference/packaging/native-image/introducing-graalvm-native-images.html",
this.platformVersion), "GraalVM Native Image Support");
boolean mavenBuild = this.build instanceof MavenBuild;
boolean gradleBuild = this.build instanceof GradleBuild;
String url = SPRING_BOOT_3_3_0_OR_LATER.match(this.platformVersion)
? String.format("https://docs.spring.io/spring-boot/%s/how-to/aot.html", this.platformVersion)
: String.format("https://docs.spring.io/spring-boot/docs/%s/%s/reference/htmlsingle/#aot",
this.platformVersion, (mavenBuild) ? "maven-plugin" : "gradle-plugin");
String url = String.format("https://docs.spring.io/spring-boot/%s/how-to/aot.html", this.platformVersion);
document.gettingStarted().addAdditionalLink(url, "Configure AOT settings in Build Plugin");

Map<String, Object> model = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import io.spring.initializr.generator.spring.documentation.HelpDocument;
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;

/**
* {@link HelpDocumentCustomizer} implementation for Observability.
Expand All @@ -31,8 +29,6 @@
*/
public class ObservabilityHelpDocumentCustomizer implements HelpDocumentCustomizer {

private static final VersionRange SPRING_BOOT_3_3_0_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0");

private final Version platformVersion;

private final Build build;
Expand All @@ -49,11 +45,8 @@ public void customize(HelpDocument document) {
.addReferenceDocLink("https://docs.micrometer.io/tracing/reference/index.html",
"Distributed Tracing Reference Guide");
document.gettingStarted()
.addReferenceDocLink(String.format(SPRING_BOOT_3_3_0_OR_LATER.match(this.platformVersion)
? "https://docs.spring.io/spring-boot/%s/reference/actuator/tracing.html"
: "https://docs.spring.io/spring-boot/docs/%s/reference/html/actuator.html#actuator.micrometer-tracing.getting-started",
this.platformVersion), "Getting Started with Distributed Tracing");

.addReferenceDocLink("https://docs.spring.io/spring-boot/%s/reference/actuator/tracing.html"
.formatted(this.platformVersion), "Getting Started with Distributed Tracing");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,7 @@

package io.spring.start.site.extension.dependency.postgresql;

import java.util.Map;

import io.spring.initializr.generator.condition.ConditionalOnRequestedDependency;
import io.spring.initializr.generator.project.ProjectDescription;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;
import io.spring.initializr.versionresolver.MavenVersionResolver;
import io.spring.start.site.container.ComposeFileCustomizer;
import io.spring.start.site.container.DockerServiceResolver;
import io.spring.start.site.container.ServiceConnections.ServiceConnection;
Expand All @@ -44,29 +37,11 @@ class PgVectorProjectGenerationConfiguration {

private static final String TESTCONTAINERS_CLASS_NAME = "org.testcontainers.containers.PostgreSQLContainer";

private static final VersionRange TESTCONTAINERS_1_19_7_OR_LATER = VersionParser.DEFAULT.parseRange("1.19.7");

private final MavenVersionResolver versionResolver;

private final ProjectDescription description;

PgVectorProjectGenerationConfiguration(MavenVersionResolver versionResolver, ProjectDescription description) {
this.versionResolver = versionResolver;
this.description = description;
}

@Bean
@ConditionalOnRequestedDependency("testcontainers")
ServiceConnectionsCustomizer pgvectorServiceConnectionsCustomizer(DockerServiceResolver serviceResolver) {
Map<String, String> resolve = this.versionResolver.resolveDependencies("org.springframework.boot",
"spring-boot-dependencies", this.description.getPlatformVersion().toString());
String testcontainersVersion = resolve.get("org.testcontainers:testcontainers");
return (serviceConnections) -> {
if (TESTCONTAINERS_1_19_7_OR_LATER.match(Version.parse(testcontainersVersion))) {
serviceResolver.doWith("pgvector", (service) -> serviceConnections.addServiceConnection(
ServiceConnection.ofContainer("pgvector", service, TESTCONTAINERS_CLASS_NAME)));
}
};
return (serviceConnections) -> serviceResolver.doWith("pgvector", (service) -> serviceConnections
.addServiceConnection(ServiceConnection.ofContainer("pgvector", service, TESTCONTAINERS_CLASS_NAME)));
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import io.spring.initializr.generator.buildsystem.DependencyScope;
import io.spring.initializr.generator.spring.documentation.HelpDocument;
import io.spring.initializr.generator.version.Version;
import io.spring.initializr.generator.version.VersionParser;
import io.spring.initializr.generator.version.VersionRange;
import io.spring.start.site.support.implicit.ImplicitDependency;
import io.spring.start.site.support.implicit.ImplicitDependency.Builder;

Expand All @@ -40,8 +38,6 @@
*/
abstract class SpringIntegrationModuleRegistry {

private static final VersionRange SPRING_BOOT_3_3_OR_LATER = VersionParser.DEFAULT.parseRange("3.3.0");

static Iterable<ImplicitDependency> create(Version platformVersion) {
List<Builder> builders = new ArrayList<>();
builders.add(onDependencies("activemq", "artemis").customizeBuild(addDependency("jms"))
Expand All @@ -66,16 +62,10 @@ static Iterable<ImplicitDependency> create(Version platformVersion) {
.customizeHelpDocument(addReferenceLink("Mail Module", "mail")));
builders.add(onDependencies("rsocket").customizeBuild(addDependency("rsocket"))
.customizeHelpDocument(addReferenceLink("RSocket Module", "rsocket")));
if (SPRING_BOOT_3_3_OR_LATER.match(platformVersion)) {
builders.add(onDependencies("security")
.customizeBuild(addDependency("spring-security-messaging", "org.springframework.security",
"spring-security-messaging", DependencyScope.COMPILE))
.customizeHelpDocument(addReferenceLink("Security Module", "security")));
}
else {
builders.add(onDependencies("security").customizeBuild(addDependency("security"))
.customizeHelpDocument(addReferenceLink("Security Module", "security")));
}
builders.add(onDependencies("security")
.customizeBuild(addDependency("spring-security-messaging", "org.springframework.security",
"spring-security-messaging", DependencyScope.COMPILE))
.customizeHelpDocument(addReferenceLink("Security Module", "security")));
builders.add(onDependencies("web").customizeBuild(addDependency("http"))
.customizeHelpDocument(addReferenceLink("HTTP Module", "http")));
builders.add(onDependencies("webflux").customizeBuild(addDependency("webflux"))
Expand Down
Loading

0 comments on commit b7a9b6c

Please sign in to comment.