|
|
@ -1,7 +1,10 @@
|
|
|
|
package cokr.xit.foundation.boot;
|
|
|
|
package cokr.xit.foundation.boot;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
|
|
|
|
import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer;
|
|
|
|
import org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer;
|
|
|
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
|
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
@ -57,6 +60,7 @@ public class DatasourceConfig {
|
|
|
|
bean.setConfigLocation(resolver.getResource("classpath:sql/mybatis-config.xml"));
|
|
|
|
bean.setConfigLocation(resolver.getResource("classpath:sql/mybatis-config.xml"));
|
|
|
|
bean.setMapperLocations(resolver.getResources("classpath:sql/mapper/**/*.xml"));
|
|
|
|
bean.setMapperLocations(resolver.getResources("classpath:sql/mapper/**/*.xml"));
|
|
|
|
bean.setPlugins(new MapperSupport());
|
|
|
|
bean.setPlugins(new MapperSupport());
|
|
|
|
|
|
|
|
bean.setDatabaseIdProvider(databaseIdProvider());
|
|
|
|
return bean;
|
|
|
|
return bean;
|
|
|
|
} catch (Exception e) {
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw Assert.runtimeException(e);
|
|
|
|
throw Assert.runtimeException(e);
|
|
|
@ -74,4 +78,14 @@ public class DatasourceConfig {
|
|
|
|
bean.setSqlSessionFactoryBeanName("sqlSession");
|
|
|
|
bean.setSqlSessionFactoryBeanName("sqlSession");
|
|
|
|
return bean;
|
|
|
|
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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|