Authored by DengXinFei

Merge branch 'test' into pre

... ... @@ -5,7 +5,7 @@
<parent>
<groupId>com.yoho</groupId>
<artifactId>yoho-starter</artifactId>
<version>1.0.4-SNAPSHOT</version>
<version>1.0.2-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf</groupId>
<artifactId>yoho-unions</artifactId>
... ...
<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" 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.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
<!-- yoho_passport 数据源 -->
<bean id="yohobuylogsMasterDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.mysql.driver}" />
<property name="url" value="${jdbc.mysql.yohopassport.master.url}" />
<property name="username" value="${jdbc.mysql.yohopassport.username}" />
<property name="password" value="${jdbc.mysql.yohopassport.password}" />
<!-- 初始化连接大小 -->
<property name="initialSize" value="${jdbc.mysql.initialSize}"></property>
<!-- 连接池最大数量 -->
<property name="maxActive" value="${jdbc.mysql.maxActive}"></property>
<!-- 连接池最大空闲 -->
<property name="maxIdle" value="${jdbc.mysql.maxIdle}"></property>
<!-- 连接池最小空闲 -->
<property name="minIdle" value="${jdbc.mysql.minIdle}"></property>
<!-- 获取连接最大等待时间 -->
<property name="maxWait" value="${jdbc.mysql.maxWait}"></property>
<!--定时对线程池中的链接进行校验 -->
<property name="testWhileIdle" value="${jdbc.mysql.testWhileIdle}"></property>
<property name="timeBetweenEvictionRunsMillis" value="${jdbc.mysql.timeBetweenEvictionRunsMillis}"></property>
<property name="validationQuery" value="${jdbc.mysql.validationQuery}"></property>
<property name="testOnBorrow" value="${jdbc.mysql.testOnBorrow}"></property>
<property name="testOnReturn" value="${jdbc.mysql.testOnReturn}"></property>
</bean>
<bean id="yohobuylogsSlaveDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.mysql.driver}" />
<property name="url" value="${jdbc.mysql.yohopassport.slave.url}" />
<property name="username" value="${jdbc.mysql.yohopassport.username}" />
<property name="password" value="${jdbc.mysql.yohopassport.password}" />
<!-- 初始化连接大小 -->
<property name="initialSize" value="${jdbc.mysql.initialSize}"></property>
<!-- 连接池最大数量 -->
<property name="maxActive" value="${jdbc.mysql.maxActive}"></property>
<!-- 连接池最大空闲 -->
<property name="maxIdle" value="${jdbc.mysql.maxIdle}"></property>
<!-- 连接池最小空闲 -->
<property name="minIdle" value="${jdbc.mysql.minIdle}"></property>
<!-- 获取连接最大等待时间 -->
<property name="maxWait" value="${jdbc.mysql.maxWait}"></property>
<!--定时对线程池中的链接进行校验 -->
<property name="testWhileIdle" value="${jdbc.mysql.testWhileIdle}"></property>
<property name="timeBetweenEvictionRunsMillis" value="${jdbc.mysql.timeBetweenEvictionRunsMillis}"></property>
<property name="validationQuery" value="${jdbc.mysql.validationQuery}"></property>
<property name="testOnBorrow" value="${jdbc.mysql.testOnBorrow}"></property>
<property name="testOnReturn" value="${jdbc.mysql.testOnReturn}"></property>
</bean>
<bean id="dynamicDataSource" class="com.yoho.core.dal.datasource.DynamicDataSource">
<property name="defaultTargetDataSource" ref="yohobuylogsMasterDataSource" />
<property name="targetDataSources">
<map>
<entry key="yohobuylogsMasterDataSource" value-ref="yohobuylogsMasterDataSource" />
</map>
</property>
</bean>
<bean id="multipleDataSourceRouter" class="com.yoho.core.dal.datasource.MultiDataSourceRouter">
<property name="defaultDBCluster" value="yohobuylogsDbCluster" />
<property name="readOnlyInSlave" value="${jdbc.mysql.readonlyinslave:false}" />
<property name="dbClusterSet">
<map>
<entry key="yohobuylogsDbCluster" value="yohobuylogsMasterDataSource,yohobuylogsMasterDataSource" />
</map>
</property>
<property name="daoDbClusterMap">
<map>
</map>
</property>
</bean>
<bean id="dataSourceMethodInterceptor" class="com.yoho.core.dal.datasource.DataSourceMethodInterceptor">
</bean>
<aop:config>
<aop:pointcut id="daoPoint" expression="execution(* com.yoho.*.dal.*.*(..)) " />
<aop:advisor pointcut-ref="daoPoint" advice-ref="dataSourceMethodInterceptor" />
</aop:config>
<!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dynamicDataSource" />
<!-- 自动扫描mapping.xml文件 -->
<property name="mapperLocations" value="classpath*:META-INF/mybatis/*.xml"></property>
</bean>
<!-- DAO接口所在包名,Spring会自动查找其下的类 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.yoho.*.dal" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
</bean>
</beans>
... ...
jdbc.mysql.driver=com.mysql.jdbc.Driver
#定义初始连接数
jdbc.mysql.initialSize=0
#定义最大连接数
jdbc.mysql.maxActive=80
#定义最大空闲
jdbc.mysql.maxIdle=60
#定义最小空闲
jdbc.mysql.minIdle=10
#定义最长等待时间
jdbc.mysql.maxWait=10000
jdbc.mysql.testWhileIdle=true
jdbc.mysql.timeBetweenEvictionRunsMillis=2000
jdbc.mysql.validationQuery=select 1
jdbc.mysql.testOnBorrow=true
jdbc.mysql.testOnReturn=true
#读操作是否只在从库
jdbc.mysql.readonlyinslave=false
#yoho_passport读写数据分离
jdbc.mysql.yohopassport.master.url=jdbc:mysql://192.168.50.69:9980/yoho_passport
jdbc.mysql.yohopassport.slave.url=jdbc:mysql://192.168.102.219:3306/yoho_passport
jdbc.mysql.yohopassport.username=yh_test
jdbc.mysql.yohopassport.password=yh_test
... ...
... ... @@ -21,6 +21,7 @@
</group>
<script>
<generate template="META-INF/autoconf/jdbc.properties" destfile="WEB-INF/classes/jdbc.properties" />
<generate template="META-INF/autoconf/config.properties" destfile="WEB-INF/classes/config.properties" />
<generate template="META-INF/autoconf/databases.yml" destfile="WEB-INF/classes/databases.yml" />
<generate template="META-INF/autoconf/logback.xml" destfile="WEB-INF/classes/logback.xml" />
... ...
jdbc.mysql.driver=com.mysql.jdbc.Driver
#定义初始连接数
jdbc.mysql.initialSize=0
#定义最大连接数
jdbc.mysql.maxActive=80
#定义最大空闲
jdbc.mysql.maxIdle=60
#定义最小空闲
jdbc.mysql.minIdle=10
#定义最长等待时间
jdbc.mysql.maxWait=10000
jdbc.mysql.testWhileIdle=true
jdbc.mysql.timeBetweenEvictionRunsMillis=2000
jdbc.mysql.validationQuery=select 1
jdbc.mysql.testOnBorrow=true
jdbc.mysql.testOnReturn=true
#读操作是否只在从库
jdbc.mysql.readonlyinslave=false
#yoho_passport读写数据分离
jdbc.mysql.yohopassport.master.url=${jdbc.mysql.yohopassport.master.url}
jdbc.mysql.yohopassport.slave.url=${jdbc.mysql.yohopassport.slave.url}
jdbc.mysql.yohopassport.username=${jdbc.mysql.yohopassport.username}
jdbc.mysql.yohopassport.password=${jdbc.mysql.yohopassport.password}
... ...
... ... @@ -3,7 +3,7 @@
<display-name>YohoBuy-Resources Service</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:META-INF/spring/spring-mybatis-datasource.xml, classpath*:META-INF/spring/spring*.xml</param-value>
<param-value>classpath*:META-INF/spring/spring*.xml</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
... ...