From 58a8bebb8c9d6b809ad92d86da0b387daeb77b37 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Fri, 22 Dec 2023 17:59:04 +0900 Subject: [PATCH] =?UTF-8?q?databaseIdProvider=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cokr/xit/foundation/boot/DatasourceConfig.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/cokr/xit/foundation/boot/DatasourceConfig.java b/src/main/java/cokr/xit/foundation/boot/DatasourceConfig.java index d2f4d69..a0394b6 100644 --- a/src/main/java/cokr/xit/foundation/boot/DatasourceConfig.java +++ b/src/main/java/cokr/xit/foundation/boot/DatasourceConfig.java @@ -1,7 +1,10 @@ package cokr.xit.foundation.boot; +import java.util.Properties; + import javax.sql.DataSource; +import org.apache.ibatis.mapping.VendorDatabaseIdProvider; import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer; import org.mybatis.spring.SqlSessionFactoryBean; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -57,6 +60,7 @@ public class DatasourceConfig { bean.setConfigLocation(resolver.getResource("classpath:sql/mybatis-config.xml")); bean.setMapperLocations(resolver.getResources("classpath:sql/mapper/**/*.xml")); bean.setPlugins(new MapperSupport()); + bean.setDatabaseIdProvider(databaseIdProvider()); return bean; } catch (Exception e) { throw Assert.runtimeException(e); @@ -74,4 +78,14 @@ public class DatasourceConfig { bean.setSqlSessionFactoryBeanName("sqlSession"); return bean; } + + @Bean + VendorDatabaseIdProvider databaseIdProvider() { + VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider(); + Properties properties = new Properties(); + properties.put("MariaDB", "mariadb"); + properties.put("Oracle", "oracle"); + databaseIdProvider.setProperties(properties); + return databaseIdProvider; + } } \ No newline at end of file