spring下配置数据源
<?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:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<bean id="placeholderConfig"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>db.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
init-method="init" destroy-method="close">
<property name="driverClassName" value="${db.jdbc.driverClass}" />
<property name="url" value="${db.jdbc.jdbcUrl}" />
<property name="username" value="${db.jdbc.username}" />
<property name="connectProperties">
<props>
<prop key="password">${db.jdbc.password}</prop>
</props>
</property>
<property name="pwdC">
<bean class="com.dp.cp.db.DBPCallback" >
</bean>
</property>
<property name="initialSize" value="5" />
<property name="minIdle" value="5" />
<property name="maxActive" value="20" />
<property name="maxWait" value="60000" />
<property name="timeBetweenEvictionRunsMillis" value="180000" />
<property name="minEvictableIdleTimeMillis" value="600000" />
<property name="validationQuery" value="SELECT 'x' from dual" />
<property name="testWhileIdle" value="true" />
<property name="testOnBorrow" value="false" />
<property name="testOnReturn" value="false" />
<property name="poolPreparedStatements" value="true" />
<property name="maxPoolPreparedStatementPerConnectionSize"
value="100" />
</bean>
<bean id="OracleDialect" class="com.dp.orm.dao.ibatis.dialect.impl.OraDialect">
</bean>
<bean id="sqlExecutor" class="com.dp.orm.dao.ibatis.executor.LSqlExecutor">
<property name="dialect" ref="OracleDialect" />
<property name="enableLimit" value="true"></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" />
</property>
</bean>
<bean id="baseDao" class="com.dp.orm.dao.ibatis.GDBIbatisImpl" init-method="initialize">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
<property name="sqlExecutor">
<ref bean="sqlExecutor" />
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref local="dataSource" />
</property>
</bean>
</beans>
分享到:
相关推荐
spring数据源配置
spring配置JNDI数据源
连接MYSQL数据库,SPRING配置文件示例。
技术分享:Spring配置数据源的三种方式 (dbcp,c3p0,jndi)
spring对数据源的建立,有时候比较含糊,通过对网上资源的整合,几篇文章也许对大家很有帮助!
Spring多数据源配置,支持mysql、oracle等多个数据源同时存在的情况
spring 配置多数据源
Spring 配置各种数据源Spring 配置各种数据源Spring 配置各种数据源Spring 配置各种数据源
用SPRING管理数据源,数据库为oracle
spring 动态多数据源配置代码,本项目是maven项目,里面有完成的配资好的spring多数据源代码和配置文件。
阐述spring的数据源配置
基于注解的Spring多数据源配置和使用 前一段时间研究了一下spring多数据源的配置和使用,为了后期从多个数据源拉取数据定时进行数据分析和报表统计做准备。由于之前做过的项目都是单数据源的,没有遇到这种场景,...
Spring配置数据源的三种方式,非常详细!
Spring多数据源配置_分布式数据 Tomcat服务器下的多数据源配置详情 一、环境及框架 Tomcat+spring+hibernate+jotm,还有就是struts、Oracle等 二、需求说明 系统里有2套不同网域的oracle数据库,之间的数据需要进行...
-- 配置数据源 --> destroy-method="close"> <value>org.gjt.mm.mysql.Driver <value>jdbc:mysql://localhost:3306/demo <value>root <value>root </bean>
一个springboot的多数据配置,从mapper到controller完整的一个业务流程
Spring Boot使用spring-data-jpa配置Mysql多数据源,可用版本
spring动态数据源整合mybatis实现的分库分表操作。 分库分表对业务代码是透明的,只需要在配置文件分配分库模版即可动态的实现分库分表的增删改查操作。
如何在spring中等价配置得到原本由jndi配置实现的数据源? 现在的问题是:由于各种原因,当不想使用jndi方式,如何等价的在spring工程内部实现配置?