spring-service.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:context="http://www.springframework.org/schema/context" 
  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.xsd 
  8. http://www.springframework.org/schema/context 
  9. http://www.springframework.org/schema/context/spring-context.xsd 
  10. http://www.springframework.org/schema/tx 
  11. http://www.springframework.org/schema/tx/spring-tx.xsd"> 
  12. <!-- 掃描service包下全部使用註解的類型 --> 
  13. <context:component-scan base-package="com.ryanjie.o2o.service"/> 
  14.  
  15. <!-- 配置事務管理器 --> 
  16. <bean id="transactionManager" 
  17. class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> 
  18. <!-- 注入數據庫鏈接池 --> 
  19. <property name="dataSource" ref="dataSource"/> 
  20. </bean> 
  21.  
  22. <!-- 配置基於註解的聲明式事務 --> 
  23. <tx:annotation-driven transaction-manager="transactionManager"/> 
  24. </beans> 
相關文章
相關標籤/搜索