transaction_aop.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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:tx="http://www.springframework.org/schema/tx"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xmlns:aop="http://www.springframework.org/schema/aop"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/tx
  10. https://www.springframework.org/schema/tx/spring-tx.xsd
  11. http://www.springframework.org/schema/context
  12. https://www.springframework.org/schema/context/spring-context.xsd
  13. http://www.springframework.org/schema/aop
  14. https://www.springframework.org/schema/aop/spring-aop.xsd
  15. ">
  16. <context:property-placeholder location="jdbc.properties"></context:property-placeholder>
  17. <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
  18. <property name="driverClassName" value="${jdbc.driver}"></property>
  19. <property name="url" value="${jdbc.url}"></property>
  20. <property name="username" value="${jdbc.username}"></property>
  21. <property name="password" value="${jdbc.password}"></property>
  22. <!-- <property name="defaultAutoCommit" value="false"></property>-->
  23. </bean>
  24. <bean id="jdbcTemp" class="org.springframework.jdbc.core.JdbcTemplate">
  25. <property name="dataSource" ref="dataSource"></property>
  26. </bean>
  27. <bean id="accountDao" class="com.transaction_.dao.impl.AccountDaoImpl">
  28. <property name="jdbcTemplate" ref="jdbcTemp"></property>
  29. </bean>
  30. <bean id="accountService" class="com.transaction_.service.impl.AccountServiceImpl">
  31. <property name="accountDao" ref="accountDao">
  32. </property>
  33. </bean>
  34. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  35. <property name="dataSource" ref="dataSource"></property>
  36. </bean>
  37. <!-- <tx:advice id="interceptor" transaction-manager="transactionManager">-->
  38. <!-- <tx:attributes>-->
  39. <!-- <tx:method name="transfer" rollback-for="java.lang.Exception" timeout="-1"/>-->
  40. <!-- </tx:attributes>-->
  41. <!-- </tx:advice>-->
  42. <!-- <aop:config>-->
  43. <!-- <aop:advisor advice-ref="interceptor" pointcut="execution(* com.transaction_.service.impl.AccountServiceImpl.*(..))"></aop:advisor>-->
  44. <!-- </aop:config>-->
  45. </beans>