spring-servic.xml/

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx.xsd">
    <!--1.扫描service包下所有使用注解的类型-->
    <context:component-scan 
    base-package="com.imooc.service"/>
    <!--2.配置事物管理器 -->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <!--3.注入数据库连接池  -->
    <property name="dataSource" ref="dataSource"/>
    </bean>
    <!-- 4.配置基于注解的声明式事物 -->
    <tx:annotation-driven transaction-manager="transactionManager"/>
</beans>
    
    

    
    
    
    
    
    
    
    
    
    
    
----------->农民工的码农转型之路
原文地址:https://www.cnblogs.com/shitulaoma/p/12393090.html