博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Ibatis DataSource configuration.

Posted on 2013-12-09 10:40  钟悍  阅读(364)  评论(0编辑  收藏  举报
<?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:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd"
    default-autowire="byName">

    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true" />
        <property name="locations">
            <list>
                <value>classpath*:jdbc.properties</value>
            </list>
        </property>
    </bean>
    
    <bean id="order-dataSource" class="org.apache.commons.dbcp.BasicDataSource"       
            destroy-method="close">       
        <property name="driverClassName" value="${jdbc.driver}" />      
        <property name="url" value="${jdbc.url.order-master}" />      
        <property name="username" value="${jdbc.username.order}" />      
        <property name="password" value="${jdbc.password.order}" />      
    </bean>  

    <bean id="order-sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation" value="classpath:ibatis/order-sqlmap-config.xml" />
        <property name="dataSource" ref="order-dataSource" />
    </bean>

</beans>