Spring配置(含事务)
来源:互联网 发布:网络搜索引擎的文章 编辑:程序博客网 时间:2024/05/17 00:51
<?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:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
default-lazy-init="false" default-autowire="byName">
<description>Spring公共配置文件</description>
<!-- 定义受环境影响易变的变量 -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="locations">
<list>
<value>classpath:application.properties</value>
<!--定义core的一些变量-->
<value>classpath:core.properties</value>
</list>
</property>
</bean>
<!-- 使用annotation 自动注册bean,并检查@Required,@Autowired的属性已被注入 -->
<context:component-scan base-package="com.weimei.ctmarket.manager"/>
<!-- 数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${manager.driver}"/>
<property name="url" value="${manager.url}"/>
<property name="username" value="${manager.username}"/>
<property name="password" value="${manager.password}"/>
</bean>
<!-- 事务 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 事务AOP-->
<aop:config proxy-target-class="true">
<aop:advisor pointcut="execution(* com.weimei.*.impl.*ServiceImpl.*(..))" advice-ref="txAdvice"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save"/>
<tx:method name="save*"/>
<tx:method name="modify"/>
<tx:method name="modify*"/>
<tx:method name="remove"/>
<tx:method name="remove*"/>
<tx:method name="delete"/>
<tx:method name="delete*"/>
<tx:method name="update"/>
<tx:method name="update*"/>
<tx:method name="insert"/>
<tx:method name="insert*"/>
<tx:method name="add"/>
<tx:method name="add*"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- 使用annotation定义事务 -->
<!--
<tx:annotation-driven transaction-manager="transactionManager"/>
-->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!--MA sqlmapclient-->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:sqlmap/sqlmap-config.xml"/>
</bean>
<!-- 导入协议包支持 -->
<import resource="classpath*:spring-protocol.xml"/>
<!--放置后台管理的dao和service-->
<import resource="classpath*:dao/*-dao.xml"></import>
<import resource="classpath*:service/ap/*-service.xml"></import>
<import resource="classpath*:service/msp/*-service.xml"></import>
<import resource="classpath*:service/sp/*-service.xml"></import>
<import resource="classpath*:api/admin/*-service.xml"></import>
<import resource="classpath*:api/*-service.xml"></import>
<import resource="classpath*:api/msp/*-service.xml"></import>
<import resource="classpath*:api/sp/*-service.xml"></import>
</beans>
- Spring配置(含事务)
- Spring + mvc,Mybatis整合 (含事务配置,分页功能)
- Spring + mvc,Mybatis整合 (含事务配置,分页功能)
- Spring Transaction 分析事务属性(事务的基本概念、配置)
- spring事务配置方法(BeanNameAutoProxyCreator)
- Spring数据库及事务配置(ibatis)
- spring事务配置方法(BeanNameAutoProxyCreator)
- spring事务配置方法(TransactionProxyFactoryBean)
- spring 事务配置详解(转)
- spring 事务配置(防止遗忘)
- spring事务配置方法(BeanNameAutoProxyCreator)
- spring事务配置方法(BeanNameAutoProxyCreator)
- Spring MVC事务配置(简)
- Mybatis-Spring 的高级配置(事务)
- Spring事务配置浅析(声明)
- spring 事务配置
- Spring+Hibernate配置事务
- Spring 事务简化配置
- try catch()(转载)
- Java Reflection-JAVA反射
- iframe 父窗口和子窗口相互的调用方法
- Configuration subversion as windows service.
- 希望对入门级的程序员有所帮助,有时间不妨看看
- Spring配置(含事务)
- 0131 链表排序
- 通用对话框中的查找/替换对话框CFindReplaceDialog在WTL中的使用
- 阿凡达,三百块,震憾,值了。。。。
- VS2003安装 FrontPage的问题
- 不说假话办不成大事
- Spring基础
- SQL时间格式转换大全
- JavaScript精粹读书笔记(7)