|
|
|
@ -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;
|
|
|
|
|
}
|
|
|
|
|
}
|