`
taotaogo1980
  • 浏览: 82322 次
社区版块
存档分类
最新评论
阅读更多

    <?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: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-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
  <property name="sessionFactory" ref="sessionFactory"/>
</bean>

<!-- 用注解来实现事务管理 --> 
<tx:annotation-driven transaction-manager="transactionManager"/> 

<!-- 定义切面实现事物管理 -->
<tx:advice id="baseTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" />
<tx:method name="save*" />
<tx:method name="add*" />
<tx:method name="update*" />
<tx:method name="modify*"/>
<tx:method name="delete*" />
<tx:method name="reg*" />
<tx:method name="release*" />
<tx:method name="leave*" />
<tx:method name="reply*" />
<tx:method name="generate*" />
<tx:method name="init*" />
<tx:method name="get*" />
<tx:method name="find*" />
<tx:method name="create*" />
<tx:method name="*" read-only="true" />
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="baseService" expression="execution(* com.cs.service..*.*(..))"/>
<aop:advisor advice-ref="baseTxAdvice" pointcut-ref="baseService"/>
</aop:config>

</beans>

 
0
1
分享到:
评论

相关推荐

    spring-boot-reference.pdf

    15.2. Importing XML Configuration 16. Auto-configuration 16.1. Gradually Replacing Auto-configuration 16.2. Disabling Specific Auto-configuration Classes 17. Spring Beans and Dependency Injection 18. ...

    spring_MVC源码

    06. &lt;param-value&gt;classpath:applicationContext*.xml&lt;/param-value&gt; 07. &lt;/context-param&gt; 08. &lt;listener&gt; 09. &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; 10. ...

    SSH第7章上机.zip ACCP8.0

    &lt;param-value&gt;classpath*:applicationContext-*.xml&lt;/param-value&gt; &lt;/context-param&gt; &lt;!-- 配置spring随web容器启动时就创建 --&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener...

    OA项目SSH整合框架

    ---------------------- applicationContext.xml ------------------------ &lt;!-- 配置SessionFactory(整合Hibernate) --&gt; &lt;context:property-placeholder location="classpath:jdbc.properties" /&gt; ...

    spring-framework-reference4.1.4

    Composing XML-based configuration metadata .......................................... 25 Using the container .......................................................................................... ...

    ssh(structs,spring,hibernate)框架中的上传下载

    WEB-INF下的applicationContext.xml为Spring的配置文件,struts-config.xml为Struts的配置文件,file-upload.jsp为文件上传页面,file-list.jsp为文件列表页面。  本文后面的章节将从数据持久层->业务层->Web层的...

    spring-framework-reference-4.1.2

    Composing XML-based configuration metadata .......................................... 25 Using the container .......................................................................................... ...

    客户关系管理系统框架搭建(二)

    * 创建hibernate.cfg.xml文件连接数据库,加载SysUserGroup.hbm.xml文件,放置src下 &lt;session-factory&gt; &lt;property name="hibernate.connection.username"&gt;root &lt;property name="hibernate.connection...

    第24次课-1 Spring与Hibernate的整合

    Spring通过ApplicationContext管理SessionFactory,可以不使用Hibernate应用必需的hibernate.cfg.xml。 Spring配置管理SessionFactory与数据库的连接,在实际的应用中,数据源会采用依赖注入的方式,传递给...

    Spring-Reference_zh_CN(Spring中文参考手册)

    XML-based configuration metadata shortcuts 3.3.3.7. 组合属性名称 3.3.4. 使用depends-on 3.3.5. 延迟初始化bean 3.3.6. 自动装配(autowire)协作者 3.3.6.1. 设置Bean使自动装配失效 3.3.7. 依赖检查 3.3.8. ...

    spring4.3.9相关jar包

    spring-oxm.jar:Spring对于object/xml映射的支持,可以让JAVA与XML之间来回切换 spring-messaging.jar: spring-test.jar:对JUNIT等测试框架的简单封装 spring-tx.jar:为JDBC、Hibernate、JDO、JPA等提供的一致的...

    Spring + Hibernate + Struts 事务配置小例子(带提示框等小技巧)

    今天修改了 applicationContext.xml,以后的事务控制就万事大吉了,里面有详细注释哦。 有什么问题可以给我留言 ^_^,大家一起进步! &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE beans PUBLIC "-//SPRING//...

    Spring中文帮助文档

    2.2.2. 更简单的XML配置 2.2.3. 可扩展的XML编写 2.2.4. Annotation(注解)驱动配置 2.2.5. 在classpath中自动搜索组件 2.3. 面向切面编程(AOP) 2.3.1. 更加简单的AOP XML配置 2.3.2. 对@AspectJ 切面的支持 ...

    Spring API

    2.2.2. 更简单的XML配置 2.2.3. 可扩展的XML编写 2.2.4. Annotation(注解)驱动配置 2.2.5. 在classpath中自动搜索组件 2.3. 面向切面编程(AOP) 2.3.1. 更加简单的AOP XML配置 2.3.2. 对@AspectJ 切面的支持 ...

    spring chm文档

    2.4.1. 在XML里更为简单的声明性事务配置 2.4.2. JPA 2.4.3. 异步的JMS 2.4.4. JDBC 2.5. Web层 2.5.1. Spring MVC的表单标签库 2.5.2. Spring MVC合理的默认值 2.5.3. Portlet 框架 2.6. 其他特性 2.6.1. ...

    Spring 2.0 开发参考手册

    2.2.1. 更简单的XML配置 2.2.2. 新的bean作用域 2.2.3. 可扩展的XML编写 2.3. 面向切面编程(AOP) 2.3.1. 更加简单的AOP XML配置 2.3.2. 对@AspectJ 切面的支持 2.4. 中间层 2.4.1. 在XML里更为简单的声明性...

    spring快速入门教程

    编写功能性测试。 配置Hibernate和Transaction。...载入Spring的applicationContext.xml文件。 设置业务代理(business delegates)和DAO的依赖性。 把spring写入Struts 程序。 如何结合Hibernate和Struts

    Spring快速入门教程

    编写功能性测试。 配置Hibernate和Transaction。 载入Spring的applicationContext.xml文件。 设置业务代理(business delegates)和DAO的依赖性。 把spring写入Struts 程序。

    spring基础教程

    spring基础教程 编写功能性测试。 配置Hibernate和Transaction。 载入Spring的applicationContext.xml文件。 设置业务代理(business delegates)和DAO的依赖性。 把spring写入Struts 程序。

    Spring基础教程

    本章包含以下内容: 编写功能性测试。 配置Hibernate和Transaction。 载入Spring的applicationContext.xml文件。 设置业务代理(business delegates)和DAO的依赖性。 把spring写入Struts 程序。

Global site tag (gtag.js) - Google Analytics