Spring配置

雨点打透心脏的1/2处 2022-08-23 05:42 127阅读 0赞
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns="http://www.springframework.org/schema/beans"
  4. xmlns:tx="http://www.springframework.org/schema/tx"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans
  7. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  8. http://www.springframework.org/schema/tx
  9. http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  10. http://www.springframework.org/schema/context
  11. http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  12. <context:annotation-config />
  13. <context:component-scan base-package="com.test.action"/>
  14. <context:component-scan base-package="com.test.biz"/>
  15. <context:component-scan base-package="com.test.dao"/>
  16. <bean id="dataSourceLocal" name="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  17. <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
  18. <property name="url" value="jdbc:oracle:thin:@10.202.6.21:1521:oradev"/>
  19. <property name="username" value="test"/>
  20. <property name="password" value="test"/>
  21. <property name="maxActive" value="30"/>
  22. <property name="maxIdle" value="20"/>
  23. <property name="maxWait" value="10000"/>
  24. </bean>
  25. <bean id="localSessionFactory" name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  26. <property name="dataSource" ref="dataSourceLocal"/>
  27. <property name="mappingLocations">
  28. <value>classpath:com/test/resource/hibernate/*.xml</value>
  29. </property>
  30. <property name="hibernateProperties">
  31. <props>
  32. <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
  33. <prop key="hibernate.show_sql">true</prop>
  34. <prop key="hibernate.jdbc.batch_size">50</prop>
  35. </props>
  36. </property>
  37. </bean>
  38. <bean id="localTransactionManager" name="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  39. <property name="sessionFactory" ref="sessionFactory"/>
  40. </bean>
  41. <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
  42. <property name="transactionManager" ref="transactionManager"/>
  43. <property name="transactionAttributes">
  44. <props>
  45. <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
  46. <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop>
  47. <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop>
  48. <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
  49. <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
  50. <prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop>
  51. <prop key="tran*">PROPAGATION_REQUIRED,-Exception</prop>
  52. <prop key="commit*">PROPAGATION_REQUIRED,-Exception</prop>
  53. <prop key="create*">PROPAGATION_REQUIRED,-Exception</prop>
  54. </props>
  55. </property>
  56. </bean>
  57. <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
  58. <property name="beanNames">
  59. <list>
  60. <value>*Biz</value>
  61. </list>
  62. </property>
  63. <property name="interceptorNames">
  64. <list>
  65. <value>transactionInterceptor</value>
  66. </list>
  67. </property>
  68. </bean>
  69. </beans>

发表评论

表情:
评论列表 (有 0 条评论,127人围观)

还没有评论,来说两句吧...

相关阅读