반응형
context-datasource.xml, context-mapper.xml, context-transaction.xml 세 영역 수정
context-datasource.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<!-- oracle -->
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.0.98:1521:orcl" />
<!-- <property name="jdbcUrl" value="jdbc:oracle:thin:@10.101.167.13:1521/oranms" /> -->
<property name="username" value="nmsdev" />
<property name="password" value="nmsdev" />
<property name="maximumPoolSize" value="20" />
<property name="minimumIdle" value="5" />
<property name="connectionTestQuery" value="SELECT 1 FROM dual" />
<property name="autoCommit" value="false" />
<property name="dataSourceProperties">
<props>
<prop key="cachePrepStmts">true</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="useServerPrepStmts">true</prop>
</props>
</property>
</bean>
<!-- oracle -->
<bean id="smsDataSource" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="jdbcUrl" value="jdbc:oracle:thin:@192.168.0.132:1521:xe" />
<property name="username" value="eom88" />
<property name="password" value="eom88" />
<property name="maximumPoolSize" value="20" />
<property name="minimumIdle" value="5" />
<property name="connectionTestQuery" value="SELECT 1 FROM dual" />
<property name="autoCommit" value="false" />
<property name="dataSourceProperties">
<props>
<prop key="cachePrepStmts">true</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="useServerPrepStmts">true</prop>
</props>
</property>
</bean>
<!-- mysql -->
<bean id="dataSource2" class="com.zaxxer.hikari.HikariDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost:3307/jianDB?useSSL=false&serverTimezone=UTC" />
<property name="username" value="root" />
<property name="password" value="U3cnc@12345" />
<property name="maximumPoolSize" value="20" />
<property name="minimumIdle" value="5" />
<property name="connectionTestQuery" value="SELECT 1 FROM dual" />
<property name="autoCommit" value="false" />
<property name="dataSourceProperties">
<props>
<prop key="cachePrepStmts">true</prop>
<prop key="prepStmtCacheSize">250</prop>
<prop key="prepStmtCacheSqlLimit">2048</prop>
<prop key="useServerPrepStmts">true</prop>
</props>
</property>
</bean>
</beans>
context-mapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- SqlSession setup for Oracle Database Layer -->
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:/egovframework/sqlmap/mappers/sql-mapper-config.xml" />
<property name="mapperLocations" value="classpath:/egovframework/sqlmap/mappers/*/*.xml" />
</bean>
<!-- SqlSession setup for Oracle Database Layer -->
<bean id="smsSqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="smsDataSource" />
<property name="configLocation" value="classpath:/egovframework/sqlmap/mappers/sql-mapper-config.xml" />
<property name="mapperLocations" value="classpath:/egovframework/sqlmap/mappers/*/*.xml" />
</bean>
<bean id="sqlSession2" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource2" />
<property name="configLocation" value="classpath:/egovframework/sqlmap/mappers2/mysql-mapper-config.xml" />
<property name="mapperLocations" value="classpath:/egovframework/sqlmap/mappers2/*/*.xml" />
</bean>
<!-- MapperConfigurer setup for MyBatis Database Layer with @Mapper("deptMapper")
in DeptMapper Interface -->
<bean class="egovframework.rte.psl.dataaccess.mapper.MapperConfigurer">
<property name="basePackage" value="kr.or.noiseinfo" />
<property name="sqlSessionFactoryBeanName" value="sqlSession" />
</bean>
<bean class="egovframework.rte.psl.dataaccess.mapper.MapperConfigurer">
<property name="basePackage" value="kr.or.jian" />
<property name="sqlSessionFactoryBeanName" value="sqlSession2" />
</bean>
</beans>
context-transaction.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="select*" read-only="true" />
<tx:method name="search*" read-only="true" />
<tx:method name="*" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<aop:config>
<aop:pointcut id="requiredTx"
expression="execution(* kr.or.noiseinfo..impl.*Impl.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="requiredTx" />
</aop:config>
<bean id="txManager2"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource2" />
</bean>
<tx:advice id="txAdvice2" transaction-manager="txManager2">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="select*" read-only="true" />
<tx:method name="search*" read-only="true" />
<tx:method name="*" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="requiredTx2"
expression="execution(* kr.or.jian..impl.*Impl.*(..))" />
<aop:advisor advice-ref="txAdvice2" pointcut-ref="requiredTx2" />
</aop:config>
</beans>
반응형
'Framework & Library > Spring & Egov' 카테고리의 다른 글
(스크랩) 전자정부 프레임워크 환경구축 방법 (0) | 2018.07.09 |
---|---|
(스크랩)@Autowired (0) | 2018.07.05 |
mybatis, mysql 사용시 pom.xml 설정 (0) | 2018.04.20 |
[스프링/전자정부] 전자정부 프레임워크 / 파일 업로드 용량 설정 (0) | 2018.04.10 |
[스프링/전자정부프레임워크] Unexpected EOF read on the socket 에러 (스크랩) (0) | 2018.01.19 |