diff --git a/mens-api/src/main/java/kr/xit/core/spring/config/support/DatasourceConfig.java b/mens-api/src/main/java/kr/xit/core/spring/config/support/DatasourceConfig.java deleted file mode 100644 index ceb36d7..0000000 --- a/mens-api/src/main/java/kr/xit/core/spring/config/support/DatasourceConfig.java +++ /dev/null @@ -1,58 +0,0 @@ -package kr.xit.core.spring.config.support; - -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import kr.xit.core.consts.Constants; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; - -import javax.sql.DataSource; - -//FIXME :: 재설정이 필요한 경우 해당 프로젝트에 동일한 파일로 재정의 하여 사용 -/** - *
- * description : Datasource 설정 - FIXME:: spring.datasource 설정이 있는 경우만 loading
- *               - 조건 : spring.datasource
- *               실제 필요한 경우만 커넥션을 점유하도록
- *               LazyConnectionDataSourceProxy 사용
- *               일반 Datasource 사용시
- *               - Spring은 트랜잭션에 진입시 데이타 소스의 커넥션을 get
- *               - ehcache, hibernate 영속성 컨택슽트 1차캐시 등에도 커넥션을 get
- *               - multi-datasource 에서 트랜잭션 진입 이후 datasource 분기 불가
- * packageName : kr.xit.core.spring.config.support
- * fileName    : DatasourceConfig
- * author      : julim
- * date        : 2023-04-28
- * ======================================================================
- * 변경일         변경자        변경 내용
- * ----------------------------------------------------------------------
- * 2023-04-28    julim       최초 생성
- *
- * 
- * @see PrimaryMybatisConfig - */ -//@ConditionalOnProperty(value = "spring", havingValue = "datasource", matchIfMissing = false) -@Slf4j -@Configuration -public class DatasourceConfig { - @Bean(name = "primaryHikariConfig") - @Primary - @ConfigurationProperties(prefix = "spring.datasource.hikari.primary") - public HikariConfig primaryHikariConfig() { - // HikariConfig hikariConfig = new HikariConfig("spring.datasource.hikari"); - // hikariConfig.setAutoCommit(false); - // return hikariConfig; - return new HikariConfig(); - } - - @Bean(Constants.PRIMARY_DATA_SOURCE) - @Primary - public DataSource primaryDataSource() throws Exception{ - //return new LazyConnectionDataSourceProxy(new HikariDataSource(primaryHikariConfig())); - return new HikariDataSource(primaryHikariConfig()); - } -} diff --git a/mens-api/src/main/java/kr/xit/core/spring/config/support/PrimaryMybatisConfig.java b/mens-api/src/main/java/kr/xit/core/spring/config/support/PrimaryMybatisConfig.java deleted file mode 100644 index eb01fcb..0000000 --- a/mens-api/src/main/java/kr/xit/core/spring/config/support/PrimaryMybatisConfig.java +++ /dev/null @@ -1,82 +0,0 @@ -package kr.xit.core.spring.config.support; - -import kr.xit.core.consts.Constants; -import lombok.extern.slf4j.Slf4j; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionFactoryBean; -import org.mybatis.spring.SqlSessionTemplate; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.*; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.jdbc.datasource.DataSourceTransactionManager; -import org.springframework.jdbc.support.lob.DefaultLobHandler; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import javax.sql.DataSource; - -//FIXME :: 재설정이 필요한 경우 해당프로젝트에 동일한 파일로 재정의 하여 사용 -/** - *
- * description : Mybatis 설정 - FIXME:: @DependsOn(value = {"dataSource"}) loading
- *               - 조건 : @DependsOn(value = {"dataSource"})
- * packageName : kr.xit.core.spring.config.support
- * fileName    : MybatisConfig
- * author      : julim
- * date        : 2023-04-28
- * ======================================================================
- * 변경일         변경자        변경 내용
- * ----------------------------------------------------------------------
- * 2023-04-28    julim       최초 생성
- *
- * 
- * @see DatasourceConfig - */ -@Slf4j -@Configuration -@MapperScan( - basePackages = { - "kr.xit.core.**.mapper", - "kr.xit.biz.**.mapper", - "kr.xit.ens.**.mapper", - }, - sqlSessionFactoryRef = Constants.PRIMARY_SQL_SESSION -) -public class PrimaryMybatisConfig { - - static final String MYBATIS_CONFIG_FILE = "classpath:/egovframework/mapper/mapper-config.xml"; - - @ConditionalOnMissingBean - @Bean - @Lazy - public DefaultLobHandler lobHandler() { - return new DefaultLobHandler(); - } - - @Primary - @Bean(name = Constants.PRIMARY_SQL_SESSION) - public SqlSessionFactory primarySqlSession(@Qualifier(Constants.PRIMARY_DATA_SOURCE)DataSource dataSource) throws Exception { - PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); - sessionFactory.setDataSource(dataSource); - sessionFactory.setConfigLocation(resolver.getResource(MYBATIS_CONFIG_FILE)); - sessionFactory.setMapperLocations(resolver.getResources("classpath:/egovframework/mapper/**/*-mysql-mapper.xml")); - return sessionFactory.getObject(); - } - - @Primary - @Bean(name = "primarySqlSessionTemplate") - public SqlSessionTemplate primarySqlSessionTemplate(@Qualifier(Constants.PRIMARY_SQL_SESSION) SqlSessionFactory sqlSessionFactory) { - return new SqlSessionTemplate(sqlSessionFactory); - } - - @Primary - @Bean - public PlatformTransactionManager primaryTransactionManager(@Qualifier(Constants.PRIMARY_DATA_SOURCE)DataSource dataSource) { - DataSourceTransactionManager dstm = new DataSourceTransactionManager(dataSource); - dstm.setGlobalRollbackOnParticipationFailure(false); - return dstm; - } -} diff --git a/mens-batch/src/main/resources/config/application-dev.yml b/mens-batch/src/main/resources/config/application-dev.yml index 14119b2..f2e4fb8 100644 --- a/mens-batch/src/main/resources/config/application-dev.yml +++ b/mens-batch/src/main/resources/config/application-dev.yml @@ -19,12 +19,12 @@ spring: # 115 server # jdbc:oracle:thin:@211.119.124.115:1521:XITSMS # xit_sms_lg / xit_sms_lg - oracle: - driver-class-name: oracle.jdbc.OracleDriver - jdbc-url: jdbc:oracle:thin:@211.119.124.115:1521:XITSMS - username: xit_sms_lg - password: xit_sms_lg - read-only: false +# oracle: +# driver-class-name: oracle.jdbc.OracleDriver +# jdbc-url: jdbc:oracle:thin:@211.119.124.115:1521:XITSMS +# username: xit_sms_lg +# password: xit_sms_lg +# read-only: false devtools: livereload: diff --git a/mens-batch/src/main/resources/config/application-local.yml b/mens-batch/src/main/resources/config/application-local.yml index ef0cb5a..5f1e277 100644 --- a/mens-batch/src/main/resources/config/application-local.yml +++ b/mens-batch/src/main/resources/config/application-local.yml @@ -19,12 +19,12 @@ spring: # 115 server # jdbc:oracle:thin:@211.119.124.115:1521:XITSMS # xit_sms_lg / xit_sms_lg - secondary: - driver-class-name: oracle.jdbc.OracleDriver - jdbc-url: jdbc:oracle:thin:@211.119.124.115:1521:XITSMS - username: xit_sms_lg - password: xit_sms_lg - read-only: false +# secondary: +# driver-class-name: oracle.jdbc.OracleDriver +# jdbc-url: jdbc:oracle:thin:@211.119.124.115:1521:XITSMS +# username: xit_sms_lg +# password: xit_sms_lg +# read-only: false devtools: livereload: diff --git a/mens-batch/src/main/java/kr/xit/core/spring/config/db/PrimaryDatasourceConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/db/PrimaryDatasourceConfig.java similarity index 100% rename from mens-batch/src/main/java/kr/xit/core/spring/config/db/PrimaryDatasourceConfig.java rename to mens-core/src/main/java/kr/xit/core/spring/config/db/PrimaryDatasourceConfig.java diff --git a/mens-batch/src/main/java/kr/xit/core/spring/config/db/PrimaryMybatisConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/db/PrimaryMybatisConfig.java similarity index 100% rename from mens-batch/src/main/java/kr/xit/core/spring/config/db/PrimaryMybatisConfig.java rename to mens-core/src/main/java/kr/xit/core/spring/config/db/PrimaryMybatisConfig.java diff --git a/mens-batch/src/main/java/kr/xit/core/spring/config/db/SecondaryDatasourceConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/db/SecondaryDatasourceConfig.java similarity index 100% rename from mens-batch/src/main/java/kr/xit/core/spring/config/db/SecondaryDatasourceConfig.java rename to mens-core/src/main/java/kr/xit/core/spring/config/db/SecondaryDatasourceConfig.java diff --git a/mens-batch/src/main/java/kr/xit/core/spring/config/db/SecondaryMybatisConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/db/SecondaryMybatisConfig.java similarity index 100% rename from mens-batch/src/main/java/kr/xit/core/spring/config/db/SecondaryMybatisConfig.java rename to mens-core/src/main/java/kr/xit/core/spring/config/db/SecondaryMybatisConfig.java diff --git a/mens-batch/src/main/java/kr/xit/core/spring/config/db/TransactionConfig.java b/mens-core/src/main/java/kr/xit/core/spring/config/db/TransactionConfig.java similarity index 100% rename from mens-batch/src/main/java/kr/xit/core/spring/config/db/TransactionConfig.java rename to mens-core/src/main/java/kr/xit/core/spring/config/db/TransactionConfig.java