<beans xmlns="http://www.springframework.org/schema/beans"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:context="http://www.springframework.org/schema/context"
|
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
http://www.springframework.org/schema/context
|
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
http://www.springframework.org/schema/mvc
|
http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
|
http://www.springframework.org/schema/tx
|
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
|
|
<!--扫描配置文件(这里指向的是之前配置的那个config.properties)-->
|
<context:property-placeholder location="classpath:config.properties" />
|
|
<!-- 导入类路径下的所有spring配置文件 -->
|
<import resource="classpath*:applicationContext-*.xml" />
|
|
<!--配置阿里DRUID数据源-->
|
<bean name="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
|
<property name="url" value="${jdbc.url}" />
|
<property name="username" value="${jdbc.username}" />
|
<property name="password" value="${jdbc.password}" />
|
|
<!-- 初始化连接大小 -->
|
<property name="initialSize" value="1" />
|
<!-- 连接池最大使用连接数量 -->
|
<property name="maxActive" value="100" />
|
<!-- 连接池最大空闲 -->
|
<!-- <property name="maxIdle" value="20" /> -->
|
<!-- 连接池最小空闲 -->
|
<property name="minIdle" value="0" />
|
<!-- 获取连接最大等待时间 -->
|
<property name="maxWait" value="60000" />
|
<property name="testOnBorrow" value="false" />
|
<property name="testOnReturn" value="false" />
|
<property name="testWhileIdle" value="true" />
|
|
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
<property name="minEvictableIdleTimeMillis" value="25200000" />
|
|
<!-- 打开removeAbandoned功能 -->
|
<property name="removeAbandoned" value="true" />
|
<!-- 1800秒,也就是30分钟 -->
|
<property name="removeAbandonedTimeout" value="1800" />
|
<!-- 关闭abanded连接时输出错误日志 -->
|
<property name="logAbandoned" value="true" />
|
|
<!-- 监控数据库 -->
|
<property name="filters" value="mergeStat" />
|
</bean>
|
|
<!-- JDBC事物管理器配置 -->
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
<property name="dataSource" ref="dataSource"/>
|
</bean>
|
|
<!-- 配置事务拦截器Bean -->
|
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
|
<!-- 为事务拦截器bean注入一个事物管理器 -->
|
<property name="transactionManager" ref="transactionManager"></property>
|
<property name="transactionAttributes">
|
<!-- 定义事务传播属性 -->
|
<props>
|
<prop key="add*">PROPAGATION_REQUIRED</prop>
|
<prop key="save*">PROPAGATION_REQUIRED</prop>
|
<prop key="insert*">PROPAGATION_REQUIRED</prop>
|
|
<prop key="remove*">PROPAGATION_REQUIRED</prop>
|
<prop key="delete*">PROPAGATION_REQUIRED</prop>
|
<prop key="reset">PROPAGATION_REQUIRED</prop>
|
|
<prop key="update*">PROPAGATION_REQUIRED</prop>
|
|
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
|
<prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
|
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
|
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
|
<prop key="paged*">PROPAGATION_REQUIRED,readOnly</prop>
|
|
</props>
|
</property>
|
</bean>
|
|
<!-- 定义BeanNameAutoProxyCreator -->
|
<bean
|
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
|
<property name="beanNames">
|
<!-- 需要自动创建事务代理的bean -->
|
<list>
|
<value>partyService</value>
|
<value>registerService</value>
|
|
<!-- wallet -->
|
<value>adminWithdrawOrderService</value>
|
<value>adminRechargeOrderService</value>
|
<!-- wallet -->
|
<value>walletService</value>
|
<value>walletLogService</value>
|
<value>exchangeRateService</value>
|
|
<!-- hobi -->
|
<value>adminSymbolsService</value>
|
<value>adminContractSymbolsService</value>
|
<value>dataService</value>
|
|
<!-- local -->
|
<value>adminItemService</value>
|
<value>adminItemLeverageService</value>
|
<value>adminAgentService</value>
|
<value>adminUserService</value>
|
<value>adminOrderService</value>
|
<value>adminMyDataService</value>
|
<value>adminUserDataService</value>
|
<value>adminPublicUserService</value>
|
<value>adminLogService</value>
|
<value>adminRechargeOrderService</value>
|
<value>adminMarketQuotationsService</value>
|
<value>adminSystemUserService</value>
|
<value>adminSysUserNotifyConfigService</value>
|
<value>resourceMappingService</value>
|
|
<!-- user -->
|
<value>adminKycService</value>
|
<value>adminKycHighLevelService</value>
|
|
<!-- rechargeblock -->
|
<value>adminRechargeBlockchainOrderService</value>
|
<value>adminChannelBlockchainService</value>
|
|
<value>adminCmsService</value>
|
<value>adminBannerService</value>
|
|
<value>adminAllStatisticsService</value>
|
<value>adminMoneyInOutStatisticsService</value>
|
<value>adminContractOrderStatisticsService</value>
|
<value>adminExchangeOrderStatisticsService</value>
|
<value>adminUserMoneyStatisticsService</value>
|
<value>adminUserAddStatisticsService</value>
|
<value>adminUserAllStatisticsService</value>
|
<value>adminFuturesOrderStatisticsService</value>
|
<value>adminFinanceStatisticsService</value>
|
<value>adminAgentAllStatisticsService</value>
|
|
<!-- adminNewsService -->
|
<value>adminNewsService</value>
|
|
<!-- adminExchange -->
|
<value>exchangeApplyOrderService</value>
|
|
<value>adminRoleAuthorityService</value>
|
|
<value>adminMinerOrderService</value>
|
<value>adminMinerService</value>
|
<value>minerService</value>
|
<value>minerOrderService</value>
|
|
|
<value>adminFundService</value>
|
<value>adminFundOrderService</value>
|
<value>adminFundManagerService</value>
|
|
<!-- contract -->
|
<value>adminContractOrderService</value>
|
<value>adminContractApplyOrderService</value>
|
<value>adminMarketQuotationsService</value>
|
<value>contractOrderService</value>
|
<value>contractApplyOrderService</value>
|
|
<value>sysparaService</value>
|
|
<!-- information -->
|
<value>informationService</value>
|
<value>adminInformationService</value>
|
|
<value>userSafewordApplyService</value>
|
<value>adminUserSafewordApplyService</value>
|
<!-- autoMonitor -->
|
<value>autoMonitorWalletService</value>
|
<value>autoMonitorOrderService</value>
|
<value>adminMiningConfigService</value>
|
<value>adminActivityService</value>
|
<value>autoMonitorPoolDataService</value>
|
|
<value>pledgeConfigService</value>
|
<value>pledgeGalaxyOrderService</value>
|
<value>adminPledgeGalaxyProfitService</value>
|
|
<value>secUserService</value>
|
<value>userRateConfigService</value>
|
|
<value>userDataService</value>
|
<value>tokenService</value>
|
<value>adminDAppUserService</value>
|
<value>autoMonitorTipService</value>
|
<value>activityOrderService</value>
|
<value>pledgeOrderService</value>
|
<value>adminAutoMonitorWithdrawService</value>
|
<value>onlineChatMessageService</value>
|
|
<value>userRecomService</value>
|
<value>autoMonitorAddressConfigService</value>
|
<value>logService</value>
|
<value>adminAutoMonitorSettleAddressConfigService</value>
|
<value>adminAutoMonitorPoolDataService</value>
|
<value>roleService</value>
|
<value>adminChannelBlockchainService</value>
|
<value>channelBlockchainService</value>
|
<value>adminWithdrawService</value>
|
<value>assetService</value>
|
<value>contractOrderService</value>
|
<value>rechargeBlockchainService</value>
|
<value>moneyLogService</value>
|
<value>adminContractManageService</value>
|
<value>futuresOrderService</value>
|
<value>profitAndLossConfigService</value>
|
<value>adminFuturesOrderService</value>
|
<value>pledgeGalaxyConfigService</value>
|
<value>financeOrderService</value>
|
<value>financeService</value>
|
|
<value>c2cPaymentMethodConfigService</value>
|
<value>c2cPaymentMethodService</value>
|
<value>c2cUserService</value>
|
<value>c2cUserParamBaseSetService</value>
|
<value>c2cAdvertService</value>
|
<value>c2cOrderService</value>
|
<value>c2cAppealService</value>
|
<value>otcOnlineChatMessageService</value>
|
</list>
|
</property>
|
<property name="interceptorNames">
|
<list>
|
<value>transactionInterceptor</value>
|
<!-- 可增加其它的interceptor -->
|
</list>
|
</property>
|
</bean>
|
|
<!--JDBC模板定义 -->
|
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
<property name="dataSource">
|
<ref bean="dataSource" />
|
</property>
|
</bean>
|
|
<!--命名JDBC模板定义 -->
|
<bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
|
<constructor-arg index="0">
|
<ref bean="dataSource" />
|
</constructor-arg>
|
</bean>
|
|
</beans>
|