spring hibernate struts

xml 代码
 
  1. xml version="1.0" encoding="UTF-8"?>  
  2. <beans xmlns="http://www.springframework.org/schema/beans"  
  3.   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  4.   xmlns:aop="http://www.springframework.org/schema/aop"  
  5.   xmlns:tx="http://www.springframework.org/schema/tx"  
  6.   xsi:schemaLocation="http://www.springframework.org/schema/beans  
  7.         http://www.springframework.org/schema/beans/spring-beans-2.0.xsd  
  8.            http://www.springframework.org/schema/aop  
  9.            http://www.springframework.org/schema/aop/spring-aop-2.0.xsd  
  10.                       http://www.springframework.org/schema/tx  
  11.                       http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">  
  12.     
  13.   <bean id="propertyConfigurer"  
  14.         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
  15.     <property name="location" value="/WEB-INF/config/jdbc.properties"/>  
  16.   bean>  
  17.     
  18.   <bean id="dataSource"  
  19.         class="com.mysql.jdbc.Driver"  
  20.         destroy-method="close">  
  21.       
  22.     <property name="driverClass"><value>${driverClass}value>property>  
  23.       
  24.     <property name="jdbcUrl"><value>${jdbcUrl}value>property>  
  25.       
  26.     <property name="user"><value>${user}value>property>  
  27.       
  28.     <property name="password"><value>${password}value>property>  
  29.     <property name="minPoolSize"><value>1value>property>  
  30.     <property name="maxPoolSize"><value>20value>property>  
  31.     <property name="maxIdleTime"><value>1800value>property>  
  32.     <property name="acquireIncrement"><value>2value>property>  
  33.     <property name="maxStatements"><value>0value>property>  
  34.     <property name="initialPoolSize"><value>2value>property>  
  35.     <property name="idleConnectionTestPeriod"><value>1800value>property>  
  36.     <property name="acquireRetryAttempts"><value>30value>property>  
  37.     <property name="breakAfterAcquireFailure"><value>truevalue>property>  
  38.     <property name="testConnectionOnCheckout"><value>falsevalue>property>  
  39.   bean>  
  40.     
  41.     
  42.     
  43.   <bean id="sessionFactory"  
  44.         class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">  
  45.       
  46.     <property name="dataSource" ref="dataSource" />  
  47.       
  48.     <property name="annotatedClasses">  
  49.       <list>  
  50.         
  51.         <value>com.daniel.lr.crbt.share.db.Uservalue>  
  52.       list>  
  53.     property>  
  54.       
  55.     <property name="hibernateProperties">  
  56.       <props>  
  57.           
  58.         <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialectprop>  
  59.           
  60.         <prop key="hibernate.hbm2ddl.auto">updateprop>  
  61.         <prop key="hibernate.show_sql">trueprop>  
  62.         <prop key="hibernate.generate_statistics">trueprop>  
  63.         <prop key="hibernate.connection.release_mode">autoprop>                       
  64.         <prop key="hibernate.autoReconnect">trueprop>  
  65.         <prop key="hibernate.bytecode.use_reflection_optimizer">trueprop>  
  66.       props>  
  67.     property>  
  68.     <property name="eventListeners">  
  69.       <map>  
  70.         <entry key="merge">  
  71.           <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>  
  72.         entry>  
  73.       map>  
  74.     property>  
  75.   bean>  
  76.   <aop:config proxy-target-class="true">  
  77.     <aop:advisor pointcut="execution(* *..Hibernate.*(..))" advice-ref="txAdvice"/>  
  78.   aop:config>  
  79.   <tx:advice id="txAdvice">  
  80.     <tx:attributes>  
  81.       <tx:method name="*" read-only="false"/>  
  82.     tx:attributes>  
  83.   tx:advice>  
  84.     
  85.   <bean id="transactionManager"  
  86.         class="org.springframework.orm.hibernate3.HibernateTransactionManager">  
  87.     <property name="sessionFactory" ref="sessionFactory"/>  
  88.   bean>  
  89.     
  90.   <bean id="userDao" class="com.daniel.lr.crbt.share.dao.UserDao">  
  91.       
  92.     <property name="sessionFactory" ref="sessionFactory"/>  
  93.   bean>  
  94.     
  95.   <bean id="userDaoProxy"  
  96.         class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">  
  97.     <property name="transactionManager" ref="transactionManager" />  
  98.     <property name="target" ref="userDao"/>  
  99.     <property name="transactionAttributeSource">  
  100.       <bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>  
  101.     property>  
  102.   bean>  
  103.     
  104.   <bean name="/login"  
  105.         class="com.daniel.lr.crbt.service.web.action.LoginAction"  
  106.         scope="prototype">  
  107.     <property name="userDao" ref="userDao"/>  
  108.   bean>  
  109. beans>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值