Spring之Service层配置文件

 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"
 6        xmlns:tx="http://www.springframework.org/schema/tx"
 8        xsi:schemaLocation="http://www.springframework.org/schema/beans
 9         http://www.springframework.org/schema/beans/spring-beans.xsd
10         http://www.springframework.org/schema/context
11         http://www.springframework.org/schema/context/spring-context.xsd
14         http://www.springframework.org/schema/tx
15         http://www.springframework.org/schema/tx/spring-tx.xsd">
18 <!-- 扫描service包下使用了service注解的类 -->
19 <context:component-scan base-package="com.imooc.o2o.service" />
20 
21 <!-- 配置transactionManager对象 -->
22 <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
23     <!-- 注入数据库连接池 -->
24     <property name="dataSource" ref="dataSource" />
25 </bean>
26 
27 <!-- 配置基于注解的声明式事务管理 -->
28 <tx:annotation-driven transaction-manager="transactionManager" />  
29 
30 </beans>           

猜你喜欢

转载自www.cnblogs.com/in-the-game-of-thrones/p/11211040.html