proxool配置

<?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:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:proxool.properties</value>
                <value>classpath:fogservice-client.properties</value>
                <value>classpath:uc-client.properties</value>                
            </list>
        </property>
    </bean>

    <bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource" destroy-method="close">
    <property name="driver">
      <value>${proxool.driverClass}</value>
    </property>
    <property name="driverUrl">
      <value>${proxool.jdbcUrl}</value>     
 <!--用戶名和密碼寫在一起才調用成功,不然會報 調用無效的參數 錯誤,下面設置用戶名和密碼的property好像是無效的,其它數據庫也是這樣
 比如mysql的也要把用戶名和密碼寫在url裏:<property name="driverUrl" value="jdbc:mysql://localhost:3306/blogdb?user=lizongbo&amp;password=lizongbo" />
 -->
    </property>
    <property name="user"> <!-- 必須在這裏也設置,但是 proxool卻不使用它,或許是個bug-->
      <value>${proxool.user}</value>
    </property>
    <property name="password"> <!-- 必須在這裏也設置,但是 proxool卻不使用它,或許是個bug-->
      <value>${proxool.password}</value>
    </property>
    <property name="alias">
      <value>nexusProxool</value>
    </property>
    <property name="prototypeCount">
      <value>${proxool.minPoolSize}</value>
    </property>
    <property name="maximumConnectionCount">
      <value>${proxool.maxPoolSize}</value>
    </property>
    <property name="minimumConnectionCount">
      <value>${proxool.minPoolSize}</value>
    </property>
    <property name="trace">
      <value>true</value>
    </property>
    <property name="verbose">
      <value>true</value>
    </property>
    <property name="houseKeepingTestSql">
    	<value>show columns from t_tag_type</value>
    </property>
    <property name="simultaneousBuildThrottle">
    	<value>${proxool.simultaneous-build-throttle}</value>
    </property>
  </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

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


    <!--Transaction Manager-->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
        <tx:attributes>
            <tx:method name="find*" read-only="true"/>
            <tx:method name="select*" read-only="true"/>
            <tx:method name="get*" read-only="true"/>
            <tx:method name="*" read-only="false" rollback-for="com.cmbtrip.exception.Exception"/>
        </tx:attributes>
    </tx:advice>


    <!--Transaction AOP-->

    <aop:config>
        <aop:pointcut id="expServiceOperation" expression="execution(* com.service.*.*(..))"/>
        <aop:advisor advice-ref="txAdvice" pointcut-ref="expServiceOperation"/>
    </aop:config>


</beans>



 proxool.property

proxool.driverClass=org.gjt.mm.mysql.Driver
proxool.jdbcUrl=jdbc:mysql://192.168.***.***:3306/DBname?useUnicode=true&characterEncoding=UTF-8
proxool.user=root
proxool.password=root
proxool.initialPoolSize=10
proxool.acquireIncrement=3
proxool.idleConnectionTestPeriod=3600
proxool.minPoolSize=5
proxool.maxPoolSize=10
proxool.maxStatements=20
proxool.numHelperThreads=10
proxool.maxIdleTime=600
proxool.houseKeepingSleepTime=90000
proxool.simultaneous-build-throttle=20

 

發佈了38 篇原創文章 · 獲贊 0 · 訪問量 3453
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章