Skip to content

Commit

Permalink
Polish "Restore R2DBC MySQL support with Spring Boot 3.1 or later"
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Aug 22, 2023
1 parent f44969d commit fb5ff99
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public class R2dbcBuildCustomizer implements BuildCustomizer<Build> {

private final boolean sqlServerIsUnmanaged;

private final boolean mysqlR2dbcNewDependency;
private final boolean mysqlR2dbcIsAsyncerDependency;

public R2dbcBuildCustomizer(Version platformVersion) {
this.borcaOrLater = SPRING_BOOT_2_7_0_OR_LATER.match(platformVersion);
this.mariaDbIsUnmanaged = SPRING_BOOT_3_0_0_OR_LATER.match(platformVersion);
this.sqlServerIsUnmanaged = SPRING_BOOT_3_0_0_OR_LATER.match(platformVersion);
this.mysqlR2dbcNewDependency = SPRING_BOOT_3_1_0_OR_LATER.match(platformVersion);
this.mysqlR2dbcIsAsyncerDependency = SPRING_BOOT_3_1_0_OR_LATER.match(platformVersion);
}

@Override
Expand All @@ -74,11 +74,13 @@ public void customize(Build build) {
addManagedDriver(build.dependencies(), "org.mariadb", "r2dbc-mariadb",
this.mariaDbIsUnmanaged ? "1.1.3" : null);
}
if (build.dependencies().has("mysql") && !this.borcaOrLater) {
addManagedDriver(build.dependencies(), "dev.miku", "r2dbc-mysql");
}
if (build.dependencies().has("mysql") && this.mysqlR2dbcNewDependency) {
addManagedDriver(build.dependencies(), "io.asyncer", "r2dbc-mysql");
if (build.dependencies().has("mysql")) {
if (!this.borcaOrLater) {
addManagedDriver(build.dependencies(), "dev.miku", "r2dbc-mysql");
}
else if (this.mysqlR2dbcIsAsyncerDependency) {
addManagedDriver(build.dependencies(), "io.asyncer", "r2dbc-mysql");
}
}
if (build.dependencies().has("postgresql")) {
String groupId = this.borcaOrLater ? "org.postgresql" : "io.r2dbc";
Expand Down

0 comments on commit fb5ff99

Please sign in to comment.