Skip to content

Commit 7746c00

Browse files
committed
Deprecate Derby support
Deprecate Derby support since Apache Derby is retired. Closes gh-48567 Signed-off-by: Philippe Marschall <[email protected]>
1 parent 252b218 commit 7746c00

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public enum DatabaseDriver {
4444

4545
/**
4646
* Apache Derby.
47+
* @deprecated Derby is retired, use HSQLDB or H2
4748
*/
49+
@Deprecated(forRemoval = true, since = "4.1")
4850
DERBY("Apache Derby", "org.apache.derby.jdbc.EmbeddedDriver", "org.apache.derby.jdbc.EmbeddedXADataSource",
4951
"SELECT 1 FROM SYSIBM.SYSDUMMY1"),
5052

module/spring-boot-jdbc/src/main/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnection.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public enum EmbeddedDatabaseConnection {
5757

5858
/**
5959
* Derby Database Connection.
60+
* @deprecated Derby is retired, use HSQLDB or H2
6061
*/
62+
@Deprecated(forRemoval = true, since = "4.1")
6163
DERBY("jdbc:derby:memory:%s;create=true"),
6264

6365
/**
@@ -83,6 +85,7 @@ public enum EmbeddedDatabaseConnection {
8385
* Returns the driver class name.
8486
* @return the driver class name
8587
*/
88+
@SuppressWarnings("removal")
8689
public @Nullable String getDriverClassName() {
8790
// See https://github.com/spring-projects/spring-boot/issues/32865
8891
return switch (this) {
@@ -97,6 +100,7 @@ public enum EmbeddedDatabaseConnection {
97100
* Returns the {@link EmbeddedDatabaseType} for the connection.
98101
* @return the database type
99102
*/
103+
@SuppressWarnings("removal")
100104
public @Nullable EmbeddedDatabaseType getType() {
101105
// See https://github.com/spring-projects/spring-boot/issues/32865
102106
return switch (this) {
@@ -117,6 +121,7 @@ public enum EmbeddedDatabaseConnection {
117121
return (this.url != null) ? String.format(this.url, databaseName) : null;
118122
}
119123

124+
@SuppressWarnings("removal")
120125
boolean isEmbeddedUrl(String url) {
121126
// See https://github.com/spring-projects/spring-boot/issues/32865
122127
return switch (this) {
@@ -151,6 +156,7 @@ public static boolean isEmbedded(@Nullable String driverClass, @Nullable String
151156
return (url == null || connection.isEmbeddedUrl(url));
152157
}
153158

159+
@SuppressWarnings("removal")
154160
private static EmbeddedDatabaseConnection getEmbeddedDatabaseConnection(String driverClass) {
155161
return Stream.of(H2, HSQLDB, DERBY)
156162
.filter((connection) -> connection.isDriverCompatible(driverClass))

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ void unknownOnNullProductName() {
6161
}
6262

6363
@Test
64+
@SuppressWarnings("removal")
6465
void databaseProductNameLookups() {
6566
assertThat(DatabaseDriver.fromProductName("newone")).isEqualTo(DatabaseDriver.UNKNOWN);
6667
assertThat(DatabaseDriver.fromProductName("Apache Derby")).isEqualTo(DatabaseDriver.DERBY);
@@ -88,6 +89,7 @@ void databaseProductNameLookups() {
8889
}
8990

9091
@Test
92+
@SuppressWarnings("removal")
9193
void databaseJdbcUrlLookups() {
9294
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:newone://localhost")).isEqualTo(DatabaseDriver.UNKNOWN);
9395
assertThat(DatabaseDriver.fromJdbcUrl("jdbc:derby:sample")).isEqualTo(DatabaseDriver.DERBY);

module/spring-boot-jdbc/src/test/java/org/springframework/boot/jdbc/EmbeddedDatabaseConnectionTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void h2CustomDatabaseName() {
5151
}
5252

5353
@Test
54+
@SuppressWarnings("removal")
5455
void derbyCustomDatabaseName() {
5556
assertThat(EmbeddedDatabaseConnection.DERBY.getUrl("myderbydb"))
5657
.isEqualTo("jdbc:derby:memory:myderbydb;create=true");
@@ -80,6 +81,7 @@ void isEmbeddedWithDriverAndUrl(String driverClassName, String url, boolean embe
8081
assertThat(EmbeddedDatabaseConnection.isEmbedded(driverClassName, url)).isEqualTo(embedded);
8182
}
8283

84+
@SuppressWarnings("removal")
8385
static Object[] embeddedDriverAndUrlParameters() {
8486
return new Object[] {
8587
new Object[] { EmbeddedDatabaseConnection.H2.getDriverClassName(), "jdbc:h2:~/test", false },

0 commit comments

Comments
 (0)