Spring配置
2016-06-08 16:06
393 查看
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" 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.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:annotation-config /> <context:component-scan base-package="com.test.action"/> <context:component-scan base-package="com.test.biz"/> <context:component-scan base-package="com.test.dao"/> <bean id="dataSourceLocal" name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@10.202.6.21:1521:oradev"/> <property name="username" value="test"/> <property name="password" value="test"/> <property name="maxActive" value="30"/> <property name="maxIdle" value="20"/> <property name="maxWait" value="10000"/> </bean> <bean id="localSessionFactory" name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSourceLocal"/> <property name="mappingLocations"> <value>classpath:com/test/resource/hibernate/*.xml</value> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.jdbc.batch_size">50</prop> </props> </property> </bean> <bean id="localTransactionManager" name="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager" ref="transactionManager"/> <property name="transactionAttributes"> <props> <prop key="add*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="save*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="update*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="tran*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="commit*">PROPAGATION_REQUIRED,-Exception</prop> <prop key="create*">PROPAGATION_REQUIRED,-Exception</prop> </props> </property> </bean> <bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"> <property name="beanNames"> <list> <value>*Biz</value> </list> </property> <property name="interceptorNames"> <list> <value>transactionInterceptor</value> </list> </property> </bean> </beans>
相关文章推荐
- Java简易日历的实现
- Java过滤器与SpringMVC拦截器之间的关系与区别
- Java中的Dialog、JOptionPane对话框
- 浅谈javaSE 面向对象(Object类toString)
- Java教程第一天
- How does Spring @Transactional Really Work?--转
- struts2中constant参数设置
- JAVA学习2:Eclipse集成Maven
- eclipse ndk 配置和简单开发demo
- JAVA枚举操作(获取值,转map集合)
- Java设计一个可追踪是否成功执行的方法
- 定义类和创建对象----电视操作
- java类加载说明
- java.lang.NoClassDefFoundError: jdk1/6/0_39
- Mybatis入门实例(四)——MyBatis与Spring 3.X的整合
- java 小题目
- JAVA 直接量
- java double类型保留两位小数4种方法【转】
- java笔记9
- JAVA学习1:Maven3环境搭建