SSM_OA.Spring,xml文件配置

来源:互联网 发布:专业足球数据网站 编辑:程序博客网 时间:2024/06/06 00:04
<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"    xmlns:tx="http://www.springframework.org/schema/tx"    xsi:schemaLocation="http://www.springframework.org/schema/beans         http://www.springframework.org/schema/beans/spring-beans-3.2.xsd        http://www.springframework.org/schema/context         http://www.springframework.org/schema/context/spring-context-3.2.xsd        http://www.springframework.org/schema/aop         http://www.springframework.org/schema/aop/spring-aop-3.2.xsd        http://www.springframework.org/schema/tx         http://www.springframework.org/schema/tx/spring-tx-3.2.xsd        http://www.springframework.org/schema/mvc         http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">    <!-- 引入数mybatis配置文件 -->    <import resource="./application-mybatis.xml" />    <!-- 事务管理器 事物管理器类型必须跟数据源类型一致 -->    <bean id="transactionManager"        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">        <property name="dataSource" ref="dataSource" />    </bean>    <!-- 配置事务控制 -->    <tx:advice id="txAdvice" transaction-manager="transactionManager">        <tx:attributes>            <tx:method name="add*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="insert*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="create*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="delete*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="remove*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="update*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />            <tx:method name="modify*" propagation="REQUIRED" read-only="false"                rollback-for="java.lang.Exception" />        </tx:attributes>        <!-- qry/query/select -->    </tx:advice>    <aop:config>        <!-- 配置切点为service层 SSM\src\com\qianfeng\application\service -->        <aop:pointcut id="pointCut"            expression="execution(* com.qsy..service.*.*(..))" />        <aop:advisor pointcut-ref="pointCut" advice-ref="txAdvice" />    </aop:config>    <!-- 扫描@Service注解的类,完成bean创建和依赖注入 (服务层、数据层) -->    <context:component-scan base-package="com.qsy"        use-default-filters="false">        <context:include-filter type="annotation"            expression="org.springframework.stereotype.Service" />    </context:component-scan></beans>