首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

applicationContext.xml配置文件通篇

2012-11-03 
applicationContext.xml配置文件全文?xml version1.0 encodingUTF-8?beans xmlnshttp://www.sp

applicationContext.xml配置文件全文
<?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: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.0.xsd">
      <bean id="placeholderConfig"
            dependency-check="none">
           <property name="driverClass">
                 <value>${datasource.driverClassName}</value>
           </property>
           <property name="jdbcUrl">
                 <value>${datasource.url}</value>
           </property>
           <property name="user">
                 <value>${datasource.username}</value>
           </property>
           <property name="password">
                 <value>${datasource.password}</value>
           </property>
           <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->
           <property name="acquireIncrement">
                 <value>${c3p0.acquireIncrement}</value>
           </property>
           <!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->
           <property name="initialPoolSize">
                 <value>${c3p0.initialPoolSize}</value>
           </property>
           <!--连接池中保留的最小连接数。-->
           <property name="minPoolSize">
                 <value>${c3p0.minPoolSize}</value>
           </property>
           <!--连接池中保留的最大连接数。Default: 15 -->
           <property name="maxPoolSize">
                 <value>${c3p0.maxPoolSize}</value>
           </property>
           <!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
           <property name="maxIdleTime">
                 <value>${c3p0.maxIdleTime}</value>
           </property>
           <!--每60秒检查所有连接池中的空闲连接。Default: 0 -->
           <property name="idleConnectionTestPeriod">
                 <value>${c3p0.idleConnectionTestPeriod}</value>
           </property>
           <!-- 最大的PreparedStatement的数量 -->
           <property name="maxStatements">
                 <value>${c3p0.maxStatements}</value>
           </property>
           <!--
                 c3p0是异步操作的,缓慢的JDBC操作通过帮助进程完成。扩展这些操作可以有效的提升性能


                 通过多线程实现多个操作同时被执行。Default: 3
           -->
           <property name="numHelperThreads">
                 <value>${c3p0.numHelperThreads}</value>
           </property>
      </bean>
<bean id="sessionFactory"
           />
           </property>
           <property name="hibernateProperties">
                 <props>
                      <prop key="hibernate.connection.provider_class">
                            org.hibernate.connection.C3P0ConnectionProvider
                      </prop>
                      <prop key="hibernate.dialect">
                            ${hibernate.dialect}
                      </prop>
                       <!-- 指定JDBC抓取数量的大小 -->
                      <prop key="hibernate.jdbc.fetch_size">
                            ${hibernate.jdbc.fetch_size}
                      </prop>
                      <!-- 允许Hibernate使用JDBC2的批量更新 -->
                      <prop key="hibernate.jdbc.batch_size">
                            ${hibernate.jdbc.batch_size}
                      </prop>
                      <!-- 输出所有SQL语句到控制台 -->
                      <prop key="hibernate.show_sql">
                            ${hibernate.show_sql}
                      </prop>
                      <!-- 在log和console中打印出更漂亮的SQL -->
                      <prop key="hibernate.format_sql">
                            ${hibernate.format_sql}
                      </prop>
                      <prop key="hibernate.c3p0.validate">true</prop>
                       <!-- 强制Hibernate按照被更新数据的主键,为SQL更新排序。这么做将减少在高并发系统中事务的死锁 -->
                      <prop key="hibernate.order_updates">true</prop>
                      <!-- 如果开启, Hibernate将收集有助于性能调节的统计数据. -->
                      <prop key="hibernate.generate_statistics">true</prop>
                      <!-- 如果开启, 在对象被删除时生成的标识属性将被重设为默认值 -->
                      <prop key="hibernate.use_identifer_rollback">true</prop>
                      <!-- 如果开启, Hibernate将在SQL中生成有助于调试的注释信息 -->
                      <prop key="hibernate.use_sql_comments">true</prop>
                 </props>
           </property>
           <property name="mappingResources">
                 <list>
                      <value>com/common/config/TbUser.hbm.xml</value>
                      <value>com/common/config/TbInsert.hbm.xml</value>
                      <value>com/common/config/TbFile.hbm.xml</value>


                 </list>
           </property>
      </bean>
      <!-- 配置事务管理器 -->
      <bean id="transactionManager"
           ref="sessionFactory"></property>
      </bean>


      <!--注解式事务配置驱动-->
      <tx:annotation-driven transaction-manager="transactionManager"
           proxy-target-/>


</beans>

热点排行