Commit 54eb6ae7 authored by wangjinjing's avatar wangjinjing

更新springbase 文件

parent 855f0cd6
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<!-- enable spring annotation scan -->
<context:annotation-config/>
<context:component-scan base-package="cn.bsystem.*" />
......@@ -23,84 +23,126 @@
<context:component-scan base-package="cn.map.*" />
<context:component-scan base-package="cn.yw.*" />
<context:component-scan base-package="cn.nhyw.*" />
<!--
<!--
<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:init.properties</value>
</property>
</bean>
-->
<bean id="beanUtil" class="cn.base.bean.BeanHelper"></bean>
<bean id="beanUtil" class="cn.base.bean.BeanHelper"></bean>
<bean id="aspectService" class="cn.base.aspect.OperateAspect"></bean>
<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>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
......@@ -108,22 +150,33 @@
</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:advisor advice-ref="txAdvice" pointcut-ref="netmanagerServiceOperation" />
</aop:config>
<aop:aspectj-autoproxy proxy-target-class="true"/>
<aop:config>
<aop:config>
<aop:aspect id="operateAspect" ref="aspectService">
<aop:pointcut expression="execution(* cn.im.*.action.*Action.*(..)) or execution(* cn.bsystem.*.action.*Action.*(..))" id="logPointcut"/>
<aop:before pointcut-ref="logPointcut" method="before"/>
<aop:around pointcut-ref="logPointcut" method="doAround"/>
<aop:after-throwing pointcut-ref="logPointcut" method="afterThrow" throwing="ex"/>
<aop:pointcut expression="execution(* cn.im.*.action.*Action.*(..)) or execution(* cn.bsystem.*.action.*Action.*(..))" id="logPointcut"/>
<aop:before pointcut-ref="logPointcut" method="before"/>
<aop:around pointcut-ref="logPointcut" method="doAround"/>
<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