<?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"
xmlns:aop="http://www.springframework.org/schema/aop"
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.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-autowire="byName">
<context:annotation-config/>
<context:component-scan base-package="com" name-generator="com.framework.util.DefaultBeanNameGenerator"/>
<!-- <aop:aspectj-autoproxy />-->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="locations">
<list>
<value>classpath:resources/application.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.web.url}" />
<property name="user" value="${jdbc.web.username}" />
<property name="password" value="${jdbc.web.password}" />
<property name="maxPoolSize" value="300" />
<property name="minPoolSize" value="30" />
<property name="maxIdleTime" value="60" />
<property name="maxStatements" value="6000" />
<property name="idleConnectionTestPeriod" value="1800" />
<property name="acquireIncrement" value="2" />
<property name="preferredTestQuery" value="select 1 from dual" />
<property name="numHelperThreads" value="10"/>
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<property name="minEvictableIdleTimeMillis" value="3600000" />
</bean>
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> -->
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">create</prop> -->
<!-- <prop key="hibernate.default_schema">unionwebsite</prop> -->
<prop key="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</prop>
<prop key="hibernate.memcached.servers">${hibernate.memcached.servers}</prop>
<!-- <prop key="hibernate.memcached.servers">10.1.7.159:11211</prop> -->
<!-- <prop key="hibernate.memcached.hashAlgorithm">HashAlgorithm.KETAMA_HASH</prop> -->
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<!-- 设置二级缓存的前缀名称 -->
<prop key="hibernate.cache.region_prefix">quality.cache.ehcache</prop>
<!-- 否使用结构化的方式缓存对象-->
<prop key="hibernate.cache.use_structured_entries">true</prop>
<!-- 是否缓存查询结果 -->
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments ">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<!-- 此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode-->
<prop key="hibernate.connection.release_mode">
auto
</prop>
</props>
</property>
<!-- <property name="mappingResources">
<list>
</list>
</property> -->
<property name="packagesToScan">
<list>
<value>com.model</value>
</list>
</property>
<!-- <property name="annotatedClasses">
<list>
<value>com.model.Notice</value>
</list>
</property> -->
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
<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"
xmlns:aop="http://www.springframework.org/schema/aop"
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.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-autowire="byName">
<context:annotation-config/>
<context:component-scan base-package="com" name-generator="com.framework.util.DefaultBeanNameGenerator"/>
<!-- <aop:aspectj-autoproxy />-->
<tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true"/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="locations">
<list>
<value>classpath:resources/application.properties</value>
</list>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}" />
<property name="jdbcUrl" value="${jdbc.web.url}" />
<property name="user" value="${jdbc.web.username}" />
<property name="password" value="${jdbc.web.password}" />
<property name="maxPoolSize" value="300" />
<property name="minPoolSize" value="30" />
<property name="maxIdleTime" value="60" />
<property name="maxStatements" value="6000" />
<property name="idleConnectionTestPeriod" value="1800" />
<property name="acquireIncrement" value="2" />
<property name="preferredTestQuery" value="select 1 from dual" />
<property name="numHelperThreads" value="10"/>
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<property name="minEvictableIdleTimeMillis" value="3600000" />
</bean>
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="hibernateProperties">
<props>
<!-- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> -->
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<!-- <prop key="hibernate.hbm2ddl.auto">create</prop> -->
<!-- <prop key="hibernate.default_schema">unionwebsite</prop> -->
<prop key="hibernate.cache.provider_class">com.googlecode.hibernate.memcached.MemcachedCacheProvider</prop>
<prop key="hibernate.memcached.servers">${hibernate.memcached.servers}</prop>
<!-- <prop key="hibernate.memcached.servers">10.1.7.159:11211</prop> -->
<!-- <prop key="hibernate.memcached.hashAlgorithm">HashAlgorithm.KETAMA_HASH</prop> -->
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<!-- 设置二级缓存的前缀名称 -->
<prop key="hibernate.cache.region_prefix">quality.cache.ehcache</prop>
<!-- 否使用结构化的方式缓存对象-->
<prop key="hibernate.cache.use_structured_entries">true</prop>
<!-- 是否缓存查询结果 -->
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments ">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<!-- 此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode-->
<prop key="hibernate.connection.release_mode">
auto
</prop>
</props>
</property>
<!-- <property name="mappingResources">
<list>
</list>
</property> -->
<property name="packagesToScan">
<list>
<value>com.model</value>
</list>
</property>
<!-- <property name="annotatedClasses">
<list>
<value>com.model.Notice</value>
</list>
</property> -->
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
<property name="cacheQueries">
<value>true</value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>