| 27 | |
---|
| 28 | --context-transaction.xml |
---|
| 29 | {{{ |
---|
| 30 | <?xml version="1.0" encoding="UTF-8"?> |
---|
| 31 | <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
---|
| 32 | xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" |
---|
| 33 | xmlns:aop="http://www.springframework.org/schema/aop" |
---|
| 34 | xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd |
---|
| 35 | http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd |
---|
| 36 | http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd |
---|
| 37 | http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> |
---|
| 38 | |
---|
| 39 | <util:properties id="contextProperties" location="classpath:context.properties"/> |
---|
| 40 | |
---|
| 41 | <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
---|
| 42 | <property name="driverClassName" value="#{contextProperties.driver}"/> |
---|
| 43 | <property name="url" value="#{contextProperties.url}"/> |
---|
| 44 | <property name="username" value="#{contextProperties.username}"/> |
---|
| 45 | <property name="password" value="#{contextProperties.password}"/> |
---|
| 46 | </bean> |
---|
| 47 | |
---|
| 48 | <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
---|
| 49 | <property name="dataSource" ref="dataSource"/> |
---|
| 50 | </bean> |
---|
| 51 | |
---|
| 52 | <tx:annotation-driven transaction-manager="txManager" /> |
---|
| 53 | |
---|
| 54 | <tx:advice id="txAdvice" transaction-manager="txManager"> |
---|
| 55 | <tx:attributes> |
---|
| 56 | <tx:method name="*" rollback-for="Exception" propagation="REQUIRED"/> |
---|
| 57 | </tx:attributes> |
---|
| 58 | </tx:advice> |
---|
| 59 | |
---|
| 60 | <aop:config> |
---|
| 61 | <aop:pointcut id="mipServiceRequiredTx" expression="execution(* *..MiPService.*(..))"/> |
---|
| 62 | <aop:pointcut id="dynamicHibernateRequiredTx" expression="execution(* *..*DynamicHibernateService.*(..))"/> |
---|
| 63 | <aop:pointcut id="jobRequiredTx" expression="execution(* *..job..*Job.execute(..))"/> |
---|
| 64 | <aop:pointcut id="flexRequiredTx" expression="execution(* *..FlexService.*(..))"/> |
---|
| 65 | <aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="flexRequiredTx" /> |
---|
| 66 | <aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="mipServiceRequiredTx" /> |
---|
| 67 | <aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="dynamicHibernateRequiredTx" /> |
---|
| 68 | <aop:advisor advice-ref="txAdvice" order="2" pointcut-ref="jobRequiredTx" /> |
---|
| 69 | </aop:config> |
---|
| 70 | </beans> |
---|
| 71 | }}} |