From 270e162479a62bdf99957f2bcfc5ecf7e6933941 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 10 Jan 2022 09:46:02 +0100 Subject: [PATCH] Stop aliasing MariaDB to MySQL Closes gh-28728 --- ...IntegrationDataSourceScriptDatabaseInitializer.java | 4 +++- ...JdbcSessionDataSourceScriptDatabaseInitializer.java | 4 +++- .../org/springframework/boot/jdbc/DatabaseDriver.java | 10 ++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceScriptDatabaseInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceScriptDatabaseInitializer.java index 281d233fcb..41ec7c79a9 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceScriptDatabaseInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationDataSourceScriptDatabaseInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -20,6 +20,7 @@ import java.util.List; import javax.sql.DataSource; +import org.springframework.boot.jdbc.DatabaseDriver; import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer; import org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver; import org.springframework.boot.sql.init.DatabaseInitializationSettings; @@ -77,6 +78,7 @@ public class IntegrationDataSourceScriptDatabaseInitializer extends DataSourceSc private static List resolveSchemaLocations(DataSource dataSource, IntegrationProperties.Jdbc properties) { PlatformPlaceholderDatabaseDriverResolver platformResolver = new PlatformPlaceholderDatabaseDriverResolver(); + platformResolver = platformResolver.withDriverPlatform(DatabaseDriver.MARIADB, "mysql"); if (StringUtils.hasText(properties.getPlatform())) { return platformResolver.resolveAll(properties.getPlatform(), properties.getSchema()); } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceScriptDatabaseInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceScriptDatabaseInitializer.java index 64f1ec5e2f..a5279ecb45 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceScriptDatabaseInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/session/JdbcSessionDataSourceScriptDatabaseInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -20,6 +20,7 @@ import java.util.List; import javax.sql.DataSource; +import org.springframework.boot.jdbc.DatabaseDriver; import org.springframework.boot.jdbc.init.DataSourceScriptDatabaseInitializer; import org.springframework.boot.jdbc.init.PlatformPlaceholderDatabaseDriverResolver; import org.springframework.boot.sql.init.DatabaseInitializationSettings; @@ -78,6 +79,7 @@ public class JdbcSessionDataSourceScriptDatabaseInitializer extends DataSourceSc private static List resolveSchemaLocations(DataSource dataSource, JdbcSessionProperties properties) { PlatformPlaceholderDatabaseDriverResolver platformResolver = new PlatformPlaceholderDatabaseDriverResolver(); + platformResolver = platformResolver.withDriverPlatform(DatabaseDriver.MARIADB, "mysql"); if (StringUtils.hasText(properties.getPlatform())) { return platformResolver.resolveAll(properties.getPlatform(), properties.getSchema()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index d381e5591a..8b682f6d48 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 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. @@ -74,13 +74,7 @@ public enum DatabaseDriver { /** * Maria DB. */ - MARIADB("MariaDB", "org.mariadb.jdbc.Driver", "org.mariadb.jdbc.MariaDbDataSource", "SELECT 1") { - - @Override - public String getId() { - return "mysql"; - } - }, + MARIADB("MariaDB", "org.mariadb.jdbc.Driver", "org.mariadb.jdbc.MariaDbDataSource", "SELECT 1"), /** * Google App Engine.