Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0b00827

Browse files
committedJan 13, 2025
Add support for AWS Advanced JDBC Wrapper
This commit adds entry for AWS Advanced JDBC Wrapper to `DatabaseDriver` enum. See spring-projectsgh-31995 Signed-off-by: Vedran Pavic <vedran@vedranpavic.com>
1 parent 679c0e4 commit 0b00827

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed
 

‎spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchDataSourceScriptDatabaseInitializerTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,8 +62,8 @@ void getSettingsWithPlatformDoesNotTouchDataSource() {
6262
}
6363

6464
@ParameterizedTest
65-
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "CLICKHOUSE", "FIREBIRD", "INFORMIX",
66-
"JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
65+
@EnumSource(value = DatabaseDriver.class, mode = Mode.EXCLUDE, names = { "AWS_JDBC_WRAPPER", "CLICKHOUSE",
66+
"FIREBIRD", "INFORMIX", "JTDS", "PHOENIX", "REDSHIFT", "TERADATA", "TESTCONTAINERS", "UNKNOWN" })
6767
void batchSchemaCanBeLocated(DatabaseDriver driver) throws SQLException {
6868
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
6969
BatchProperties properties = new BatchProperties();

‎spring-boot-project/spring-boot-parent/build.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ bom {
2525
]
2626
}
2727
}
28+
library("AWS Advanced JDBC Wrapper", "2.5.4") {
29+
group("software.amazon.jdbc") {
30+
modules = [
31+
"aws-advanced-jdbc-wrapper"
32+
]
33+
}
34+
}
2835
library("C3P0", "0.9.5.5") {
2936
group("com.mchange") {
3037
modules = [

‎spring-boot-project/spring-boot/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ dependencies {
100100
optional("org.yaml:snakeyaml")
101101
optional("org.jetbrains.kotlin:kotlin-reflect")
102102
optional("org.jetbrains.kotlin:kotlin-stdlib")
103+
optional("software.amazon.jdbc:aws-advanced-jdbc-wrapper") {
104+
exclude(group: "commons-logging", module: "commons-logging")
105+
}
103106

104107
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
105108
testImplementation("org.springframework:spring-core-test")

‎spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.util.Arrays;
2020
import java.util.Collection;
2121
import java.util.Collections;
22+
import java.util.List;
2223
import java.util.Locale;
2324

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

222+
},
223+
224+
/**
225+
* AWS Advanced JDBC Wrapper.
226+
* @since 3.5.0
227+
*/
228+
AWS_JDBC_WRAPPER(null, "software.amazon.jdbc.Driver") {
229+
230+
@Override
231+
protected Collection<String> getUrlPrefixes() {
232+
return List.of("aws-wrapper");
233+
}
234+
221235
};
222236

223237
private final String productName;

‎spring-boot-project/spring-boot/src/test/java/org/springframework/boot/jdbc/DatabaseDriverTests.java

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ void databaseJdbcUrlLookups() {
121121
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:clickhouse://localhost:3306/sample"))
122122
.isEqualTo(DatabaseDriver.CLICKHOUSE);
123123
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:ch://localhost:3306/sample")).isEqualTo(DatabaseDriver.CLICKHOUSE);
124+
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:aws-wrapper:postgresql://127.0.0.1:5432/sample"))
125+
.isEqualTo(DatabaseDriver.AWS_JDBC_WRAPPER);
124126
}
125127

126128
}

0 commit comments

Comments
 (0)
Please sign in to comment.