sqlMapClient在spring中的配置

 <bean id="propertyConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:config/ServerXmlConfig.properties</value>
</list>
</property>
</bean>

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">

<property name="driverClassName"
value="${dataSource.driverClassName}" />
<property name="url" value="${dataSource.url}" />
<property name="username" value="${dataSource.username}" />
<property name="password" value="${dataSource.password}" />
    <property name="maxActive" value="100" />  
        <property name="maxIdle" value="70" />  
        <property name="maxWait" value="100000" />  
        <!--
        <property name="defaultAutoCommit" value="true"/>  
        <property name="removeAbandoned" value="true"/>  
      <property name="removeAbandonedTimeout" value="30"/>  
        <property name="logAbandoned" value="true"/>  
        -->

</bean> 

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


   其中链接数据库的几个变量放在一个config下的ServerXmlConfig.properties文件中,





欢迎关注公众号:Java后端技术全栈