|
@@ -0,0 +1,43 @@
|
|
|
|
|
+package com.style24.core.support.config;
|
|
|
|
|
+
|
|
|
|
|
+import javax.naming.NamingException;
|
|
|
|
|
+import javax.sql.DataSource;
|
|
|
|
|
+
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
|
|
+import org.springframework.transaction.PlatformTransactionManager;
|
|
|
|
|
+import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
|
+
|
|
|
|
|
+import com.gagaframework.web.core.config.GagaJndiBaseConfig;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * Cj Transaction Manager 설정
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author moon
|
|
|
|
|
+ * @since 2021. 04. 09
|
|
|
|
|
+ */
|
|
|
|
|
+@Configuration
|
|
|
|
|
+@Lazy
|
|
|
|
|
+@EnableTransactionManagement
|
|
|
|
|
+public class TscJndiCjConfig extends GagaJndiBaseConfig {
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * destroyMethod = "close" 속성은 apache commons DBCP와 BasicDataSource 등에서
|
|
|
|
|
+ * 즉시 DataSource를 종료하고자 할 때에 사용하는 것으로 DriverManagerDataSource에서는 필요하지 않다.
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ // @Bean(name = "defaultDataSource", destroyMethod = "close")
|
|
|
|
|
+ @Bean(name = "cjDataSource")
|
|
|
|
|
+ public DataSource dataSource() throws IllegalArgumentException, NamingException {
|
|
|
|
|
+ return super.getDataSource("jdbc/cjDs");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ @Bean(name = "cjTxnManager")
|
|
|
|
|
+ public PlatformTransactionManager transactionManager(@Qualifier("cjDataSource") DataSource dataSource) throws NamingException {
|
|
|
|
|
+ return super.getTransactionManager(dataSource);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|