Commit 54eb6ae7 authored by wangjinjing's avatar wangjinjing

更新springbase 文件

parent 855f0cd6
......@@ -36,67 +36,109 @@
<bean id="moduleConfFactory" class="cn.base.conf.ModuleConfFactory"></bean>
<bean class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close" id="dataSource">
<property name="driverClassName">
<value>oracle.jdbc.OracleDriver</value>
</property>
<!-- <property name="url">-->
<!-- <value>jdbc:oracle:thin:@10.10.10.200:1521:orcl</value>-->
<!-- </property> -->
<!-- <property name="username">-->
<!-- <value>oa01</value>-->
<!-- </property>-->
<!-- <property name="password">-->
<!-- <value>oaoaoa7</value>-->
<!-- </property>-->
<property name="url">
<value>jdbc:oracle:thin:@61.155.110.210:7001:orcl</value>
</property>
<property name="username">
<value>IMP</value>
</property>
<property name="password">
<value>imp</value>
</property>
<property name="initialSize">
<value>5</value>
</property>
<property name="minIdle">
<value>5</value>
</property>
<property name="maxIdle">
<value>20</value>
</property>
<property name="maxTotal">
<value>30</value>
</property>
<property name="removeAbandonedOnBorrow">
<value>true</value>
</property>
<property name="removeAbandonedTimeout">
<value>60</value>
</property>
<property name="logAbandoned">
<value>true</value>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="classpath:db.properties"/>
</bean>
<bean id="dataSourceAspect" class="cn.datasource.DynamicDataSourceAspect" />
<!-- 数据源1-->
<bean id="datasource1" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${datasource1.driver}"/>
<property name="url" value="${datasource1.url}"/>
<property name="username" value="${datasource1.username}"/>
<property name="password" value="${datasource1.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="minIdle" value="${jdbc.minIdle}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}"/>
<property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}"/>
<property name="testWhileIdle" value="${jdbc.testWhileIdle}"/>
<property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}"/>
<property name="numTestsPerEvictionRun" value="${jdbc.numTestsPerEvictionRun}"/>
</bean>
<!-- 数据源2-->
<bean id="datasource2" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${datasource2.driver}"/>
<property name="url" value="${datasource2.url}"/>
<property name="username" value="${datasource2.username}"/>
<property name="password" value="${datasource2.password}"/>
<property name="initialSize" value="${jdbc.initialSize}"/>
<property name="minIdle" value="${jdbc.minIdle}"/>
<property name="maxIdle" value="${jdbc.maxIdle}"/>
<property name="defaultAutoCommit" value="${jdbc.defaultAutoCommit}"/>
<property name="removeAbandonedTimeout" value="${jdbc.removeAbandonedTimeout}"/>
<property name="testWhileIdle" value="${jdbc.testWhileIdle}"/>
<property name="timeBetweenEvictionRunsMillis" value="${jdbc.timeBetweenEvictionRunsMillis}"/>
<property name="numTestsPerEvictionRun" value="${jdbc.numTestsPerEvictionRun}"/>
</bean>
<!-- 配置动态配置数据源 -->
<bean id ="dynamicDataSource" class= "cn.datasource.DynamicDataSource">
<!-- 默认使用dataSource1的数据源 -->
<property name ="defaultTargetDataSource" ref="datasource1"></property>
<property name ="targetDataSources">
<map key-type ="java.lang.String">
<entry key= "datasource1" value-ref="datasource1"></entry>
<entry key= "datasource2" value-ref="datasource2"></entry>
</map>
</property>
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation">
<value>classpath:sqlMapConfig.xml</value>
</property>
<property name="dataSource">
<ref bean="dataSource" />
<ref bean="dynamicDataSource" />
</property>
<!-- <property name="lobHandler"><ref local="oracleLobHandler"/></property> -->
<!-- <property name="lobHandler"><ref local="oracleLobHandler"/></property> -->
</bean>
<!-- <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true"></bean> -->
<!-- <bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.OracleLobHandler" lazy-init="true"></bean> -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource" />
<ref local="dynamicDataSource" />
</property>
</bean>
......@@ -108,14 +150,24 @@
</tx:attributes>
</tx:advice>
<context:annotation-config />
<aop:aspectj-autoproxy proxy-target-class="true"/>
<aop:config>
<!-- 动态数据源切割 -->
<aop:aspect id="dynamicAspect" ref="dataSourceAspect" >
<aop:pointcut id="pointCut" expression="execution(* cn.*.service.*.*(..))" />
<aop:after pointcut-ref="pointCut" method="afterSwitchDS"/>
<aop:before pointcut-ref="pointCut" method="beforeSwitchDS"/>
</aop:aspect>
</aop:config>
<aop:config>
<aop:pointcut id="netmanagerServiceOperation" expression="bean(*Service)" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="netmanagerServiceOperation" />
</aop:config>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<aop:config>
<aop:aspect id="operateAspect" ref="aspectService">
<aop:pointcut expression="execution(* cn.im.*.action.*Action.*(..)) or execution(* cn.bsystem.*.action.*Action.*(..))" id="logPointcut"/>
......@@ -124,6 +176,7 @@
<aop:after-throwing pointcut-ref="logPointcut" method="afterThrow" throwing="ex"/>
</aop:aspect>
</aop:config>
<import resource="springService.xml" />
</beans>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment