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: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.0.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
- <bean id="propertyConfigurer"
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location" value="/WEB-INF/config/jdbc.properties"/>
- bean>
- <bean id="dataSource"
- class="com.mysql.jdbc.Driver"
- destroy-method="close">
- <property name="driverClass"><value>${driverClass}value>property>
- <property name="jdbcUrl"><value>${jdbcUrl}value>property>
- <property name="user"><value>${user}value>property>
- <property name="password"><value>${password}value>property>
- <property name="minPoolSize"><value>1value>property>
- <property name="maxPoolSize"><value>20value>property>
- <property name="maxIdleTime"><value>1800value>property>
- <property name="acquireIncrement"><value>2value>property>
- <property name="maxStatements"><value>0value>property>
- <property name="initialPoolSize"><value>2value>property>
- <property name="idleConnectionTestPeriod"><value>1800value>property>
- <property name="acquireRetryAttempts"><value>30value>property>
- <property name="breakAfterAcquireFailure"><value>truevalue>property>
- <property name="testConnectionOnCheckout"><value>falsevalue>property>
- bean>
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
- <property name="dataSource" ref="dataSource" />
- <property name="annotatedClasses">
- <list>
- <value>com.daniel.lr.crbt.share.db.Uservalue>
- list>
- property>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialectprop>
- <prop key="hibernate.hbm2ddl.auto">updateprop>
- <prop key="hibernate.show_sql">trueprop>
- <prop key="hibernate.generate_statistics">trueprop>
- <prop key="hibernate.connection.release_mode">autoprop>
- <prop key="hibernate.autoReconnect">trueprop>
- <prop key="hibernate.bytecode.use_reflection_optimizer">trueprop>
- props>
- property>
- <property name="eventListeners">
- <map>
- <entry key="merge">
- <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
- entry>
- map>
- property>
- bean>
- <aop:config proxy-target-class="true">
- <aop:advisor pointcut="execution(* *..Hibernate.*(..))" advice-ref="txAdvice"/>
- aop:config>
- <tx:advice id="txAdvice">
- <tx:attributes>
- <tx:method name="*" read-only="false"/>
- tx:attributes>
- tx:advice>
- <bean id="transactionManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"/>
- bean>
- <bean id="userDao" class="com.daniel.lr.crbt.share.dao.UserDao">
- <property name="sessionFactory" ref="sessionFactory"/>
- bean>
- <bean id="userDaoProxy"
- class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
- <property name="transactionManager" ref="transactionManager" />
- <property name="target" ref="userDao"/>
- <property name="transactionAttributeSource">
- <bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>
- property>
- bean>
- <bean name="/login"
- class="com.daniel.lr.crbt.service.web.action.LoginAction"
- scope="prototype">
- <property name="userDao" ref="userDao"/>
- bean>
- beans>