jeecms 2012 源码分析(8) 相关配置文件分析
application-context.xml
转载请标识出处 by chenbo:http://blog.csdn.net/chenbo19867758/article/details/12844765
<?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:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsdhttp://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"default-lazy-init="true"><bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"><property name="locations"><list><value>/WEB-INF/config/jdbc.properties</value></list></property></bean><!-- C3P0 数据库连接池配置 --><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${jdbc.driverClassName}" /><property name="jdbcUrl" value="${jdbc.url}" /><property name="user" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /><!--连接关闭时默认将所有未提交的操作回滚。Default: false --> <property name="autoCommitOnClose" value="true"/><!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出 SQLException,如设为0则无限期等待。单位毫秒。Default: 0 --> <property name="checkoutTimeout" value="${cpool.checkoutTimeout}"/><!--初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 --> <property name="initialPoolSize" value="${cpool.minPoolSize}"/><!--连接池中保留的最小连接数。--> <property name="minPoolSize" value="${cpool.minPoolSize}"/><!--连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize" value="${cpool.maxPoolSize}"/><!--最大空闲时间,maxIdleTime秒内未使用则连 接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime" value="${cpool.maxIdleTime}"/><!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement" value="${cpool.acquireIncrement}"/><!--default : 0 单位 s这个配置主要是为了减轻连接池的负载,比如连接池中连接数因为某次数据访问高峰导致创建了很多数据连接但是后面的时间段需要的数据库连接数很少,则此时连接池完全没有必要维护那么多的连接,所以有必要将断开丢弃掉一些连接来减轻负载,必须小于maxIdleTime。配置不为0,则会将连接池中的连接数量保持到minPoolSize。为0则不处理。 --><property name="maxIdleTimeExcessConnections" value="${cpool.maxIdleTimeExcessConnections}"/></bean><bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><property name="dataSource" ref="dataSource"/><property name="mappingLocations"><list><value>classpath*:/com/jeecms/core/entity/hbm/*.hbm.xml</value><value>classpath*:/com/jeecms/cms/entity/main/hbm/*.hbm.xml</value><value>classpath*:/com/jeecms/cms/entity/assist/hbm/*.hbm.xml</value></list></property><property name="hibernateProperties"><value><!-- 指定数据库方言 -->hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect<!-- 输出所有SQL语句到控制台 -->hibernate.show_sql=false<!-- 格式化输出sql语句 -->hibernate.format_sql=false<!-- 这个配置意思是当你在Hibernate里面输入true的时候,Hibernate会转化为0插入数据库,当你在Hibernate里面输入false的时候,Hibernate会转化为1插入数据库, -->hibernate.query.substitutions=true 1, false 0<!-- 指定每次提交SQL的数量。参数值越大,读数据库的次数越少,速度越快。 -->hibernate.jdbc.batch_size=20<!-- 允许查询缓存,对经常使用的List查询方式,只有在使用查询缓存时,才会从缓存中通过id去get缓存的值;查询缓存一般缓存查询语句和查询结果的id -->hibernate.cache.use_query_cache=true</value></property><property name="entityInterceptor"> <ref local="treeInterceptor"/></property><property name="cacheProvider"><ref local="cacheProvider"/></property><property name="lobHandler"><ref bean="lobHandler" /></property></bean><!-- 处理 LOB 数据,CLOB 类型,BLOB 类型 --><bean id="lobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler" lazy-init="true"/><!-- 缓存 --><bean id="cacheProvider" class="com.jeecms.common.hibernate3.SpringEhCacheProvider"><property name="configLocation"><value>classpath:ehcache-hibernate.xml</value></property><property name="diskStoreLocation"><value>/WEB-INF/cache/hibernate</value></property></bean><!-- 栏目等树形结构 --><bean id="treeInterceptor" class="com.jeecms.common.hibernate3.TreeIntercptor"/><!-- 定义事务管理器(声明式的事务) --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"><property name="sessionFactory" ref="sessionFactory" /></bean><!-- 是隐式地向 Spring 容器注册 --><context:annotation-config/><tx:annotation-driven transaction-manager="transactionManager" /></beans>
转载请标识出处 by chenbo:http://blog.csdn.net/chenbo19867758/article/details/12844765