Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AWS Advanced JDBC Wrapper #43812

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2024 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,8 +62,8 @@ void getSettingsWithPlatformDoesNotTouchDataSource() {
}

@ParameterizedTest
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "CLICKHOUSE", "FIREBIRD", "INFORMIX",
"JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "AWS_JDBC_WRAPPER", "CLICKHOUSE",
"FIREBIRD", "INFORMIX", "JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
void batchSchemaCanBeLocated(DatabaseDriver driver) throws SQLException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
BatchProperties properties = new BatchProperties();
Expand Down
7 changes: 7 additions & 0 deletions spring-boot-project/spring-boot-parent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ bom {
]
}
}
library("AWS Advanced JDBC Wrapper", "2.5.4") {
group("software.amazon.jdbc") {
modules = [
"aws-advanced-jdbc-wrapper"
]
}
}
library("C3P0", "0.9.5.5") {
group("com.mchange") {
modules = [
Expand Down
3 changes: 3 additions & 0 deletions spring-boot-project/spring-boot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ dependencies {
optional("org.yaml:snakeyaml")
optional("org.jetbrains.kotlin:kotlin-reflect")
optional("org.jetbrains.kotlin:kotlin-stdlib")
optional("software.amazon.jdbc:aws-advanced-jdbc-wrapper") {
exclude(group: "commons-logging", module: "commons-logging")
}

testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation("org.springframework:spring-core-test")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

import org.springframework.util.Assert;
Expand Down Expand Up @@ -218,6 +219,19 @@ protected Collection<String> getUrlPrefixes() {
return Arrays.asList("ch", "clickhouse");
}

},

/**
* AWS Advanced JDBC Wrapper.
* @since 3.5.0
*/
AWS_JDBC_WRAPPER(null, "software.amazon.jdbc.Driver") {

@Override
protected Collection<String> getUrlPrefixes() {
return List.of("aws-wrapper");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used List#of as it seems to be the simplest option, but note that implementations of #getUrlPrefixes in this enum are quite inconsistent - there are usages of Arrays#asList and Collections#singleton.

Perhaps this could be aligned in a separate issue to use List#of consistently (first-timers-only candidate?).

}

};

private final String productName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ void databaseJdbcUrlLookups() {
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:clickhouse://localhost:3306/sample"))
.isEqualTo(DatabaseDriver.CLICKHOUSE);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:ch://localhost:3306/sample")).isEqualTo(DatabaseDriver.CLICKHOUSE);
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:aws-wrapper:postgresql://127.0.0.1:5432/sample"))
.isEqualTo(DatabaseDriver.AWS_JDBC_WRAPPER);
}

}
Loading