Spring事务管理中@Transactional的参数配置

2023-05-16

Spring作为低侵入的Java EE框架之一,能够很好地与其他框架进行整合,其中Spring与Hibernate的整合实现的事务管理是常用的一种功能。  所谓事务,就必须具备ACID特性,即原子性、一致性、隔离性和持久性

注意@Transactional 注解及其支持类所提供的功能最低要求使用Java 5(Tiger)。

除了基于XML文件的声明式事务配置外,你也可以采用基于注解式的事务配置方法。直接在Java源代码中声明事务语义的做法让事务声明和将受其影响的代码距离更近了,而且一般来说不会有不恰当的耦合的风险,因为,使用事务性的代码几乎总是被部署在事务环境中。

下面的例子很好地演示了 @Transactional 注解的易用性,随后解释其中的细节。先看看其中的类定义:

<!-- the service class that we want to make transactional -->
@Transactional 
public class DefaultFooService implements FooService { 
       Foo getFoo(String fooName); 
       Foo getFoo(String fooName, String barName); 
       void insertFoo(Foo foo); 
       void updateFoo(Foo foo); 
} 

当上述的POJO定义在Spring IoC容器里时,上述bean实例仅仅通过 行xml配置就可以使它具有事务性的。如下:

<!-- from the file 'context.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: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">

  <!-- this is the service object that we want to make transactional -->
  <bean id="fooService" class="x.y.service.DefaultFooService"/>

  <!-- enable the configuration of transactional behavior based on annotations -->
  <tx:annotation-driven transaction-manager="txManager"/>

  <!-- a PlatformTransactionManager is still required -->
  <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <!-- (this dependency is defined somewhere else) -->
    <property name="dataSource" ref="dataSource"/>
  </bean>

  <!-- other <bean/> definitions here -->
  

</beans>

提示

实际上,如果你用 'transactionManager' 来定义 PlatformTransactionManager bean的名字的话,你就可以忽略 <tx:annotation-driven/> 标签里的 'transaction-manager' 属性。 如果 PlatformTransactionManager bean你要通过其它名称来注入的话,你必须用 'transaction-manager' 属性来指定它,如上所示。

方法的可见度和 @Transactional

@Transactional 注解应该只被应用到 public 可见度的方法上。 如果你在 protected、private 或者 package-visible 的方法上使用 @Transactional 注解,它也不会报错, 但是这个被注解的方法将不会展示已配置的事务设置。

@Transactional 注解可以被应用于接口定义和接口方法、类定义和类的 public 方法上。然而,请注意仅仅 @Transactional 注解的出现不足于开启事务行为,它仅仅 是一种元数据,能够被可以识别 @Transactional 注解和上述的配置适当的具有事务行为的beans所使用。上面的例子中,其实正是 <tx:annotation-driven/>元素的出现 开启 了事务行为。

Spring团队的建议是你在具体的类(或类的方法)上使用 @Transactional 注解,而不要使用在类所要实现的任何接口上。你当然可以在接口上使用 @Transactional 注解,但是这将只能当你设置了基于接口的代理时它才生效。因为注解是 不能继承 的,这就意味着如果你正在使用基于类的代理时,那么事务的设置将不能被基于类的代理所识别,而且对象也将不会被事务代理所包装(将被确认为严重的)。因此,请接受Spring团队的建议并且在具体的类上使用 @Transactional 注解。

注意

当使用 @Transactional 风格的进行声明式事务定义时,你可以通过 <tx:annotation-driven/> 元素的 "proxy-target-class" 属性值来控制是基于接口的还是基于类的代理被创建。如果 "proxy-target-class" 属值被设置为 "true",那么基于类的代理将起作用(这时需要CGLIB库cglib.jar在CLASSPATH中)。如果 "proxy-target-class" 属值被设置为 "false" 或者这个属性被省略,那么标准的JDK基于接口的代理将起作用。

在多数情形下,方法的事务设置将被优先执行。在下列情况下,例如: DefaultFooService 类被注解为只读事务,但是,这个类中的 updateFoo(Foo) 方法的 @Transactional 注解的事务设置将优先于类级别注解的事务设置。

@Transactional(readOnly = true)
public class DefaultFooService implements FooService {

    public Foo getFoo(String fooName) {
        // do something
    }

    // these settings have precedence for this method
    @Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
    public void updateFoo(Foo foo) {
        // do something
        
    }
}

9.5.6.1. @Transactional 有关的设置

@Transactional 注解是用来指定接口、类或方法必须拥有事务语义的元数据。 如:“当一个方法开始调用时就开启一个新的只读事务,并停止掉任何现存的事务”。 默认的 @Transactional 设置如下:

  • 事务传播设置是 PROPAGATION_REQUIRED

  • 事务隔离级别是 ISOLATION_DEFAULT

  • 事务是 读/写

  • 事务超时默认是依赖于事务系统的,或者事务超时没有被支持。

  • 任何 RuntimeException 将触发事务回滚,但是任何 checked Exception 将不触发事务回滚

这些默认的设置当然也是可以被改变的。 @Transactional 注解的各种属性设置总结如下:

 

表 9.2. @Transactional 注解的属性

属性类型描述
传播性枚举型:Propagation可选的传播性设置
隔离性枚举型:Isolation可选的隔离性级别(默认值:ISOLATION_DEFAULT
只读性布尔型读写型事务 vs. 只读型事务
超时int型(以秒为单位)事务超时
回滚异常类(rollbackFor)一组 Class 类的实例,必须是Throwable 的子类一组异常类,遇到时 必须 进行回滚。默认情况下checked exceptions不进行回滚,仅unchecked exceptions(即RuntimeException的子类)才进行事务回滚。
回滚异常类名(rollbackForClassname)一组 Class 类的名字,必须是Throwable的子类一组异常类名,遇到时 必须 进行回滚
不回滚异常类(noRollbackFor)一组 Class 类的实例,必须是Throwable 的子类一组异常类,遇到时 必须不 回滚。
不回滚异常类名(noRollbackForClassname)一组 Class 类的名字,必须是Throwable 的子类一组异常类,遇到时 必须不 回滚


9.5.7. 插入事务操作

考虑这样的情况,你有一个类的实例,而且希望 同时插入事务性通知(advice)和一些简单的剖析(profiling)通知。那么,在<tx:annotation-driven/>环境中该怎么做?

我们调用 updateFoo(Foo) 方法时希望这样:

  • 配置的剖析切面(profiling aspect)开始启动,

  • 然后进入事务通知(根据配置创建一个新事务或加入一个已经存在的事务),

  • 然后执行原始对象的方法,

  • 然后事务提交(我们假定这里一切正常),

  • 最后剖析切面报告整个事务方法执行过程花了多少时间。

注意

这章不是专门讲述AOP的任何细节(除了应用于事务方面的之外)。请参考 第 6 章 使用Spring进行面向切面编程(AOP) 章以获得对各种AOP配置及其一般概念的详细叙述。

这里有一份简单的剖析切面(profiling aspect)的代码。(注意,通知的顺序是由 Ordered 接口来控制的。要想了解更多细节,请参考 第 6.2.4.7 节 “通知(Advice)顺序” 节。)

package x.y;

import org.aspectj.lang.ProceedingJoinPoint;
import org.springframework.util.StopWatch;
import org.springframework.core.Ordered;

public class SimpleProfiler implements Ordered {

    private int order;

    // allows us to control the ordering of advice
    public int getOrder() {
        return this.order;
    }

    public void setOrder(int order) {
        this.order = order;
    }

    // this method is the around advice
    public Object profile(ProceedingJoinPoint call) throws Throwable {
        Object returnValue;
        StopWatch clock = new StopWatch(getClass().getName());
        try {
            clock.start(call.toShortString());
            returnValue = call.proceed();
        } finally {
            clock.stop();
            System.out.println(clock.prettyPrint());
        }
        return returnValue;
    }
}

这里是帮助满足我们上述要求的配置数据。
<?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="fooService" class="x.y.service.DefaultFooService"/>

    <!-- this is the aspect -->
    <bean id="profiler" class="x.y.SimpleProfiler">
        <!-- execute before the transactional advice (hence the lower order number) -->
        
        <property name="order" value="1"/>
    </bean>
    
    <tx:annotation-driven transaction-manager="txManager"/>

    <aop:config>
        <!-- this advice will execute around the transactional advice -->
        <aop:aspect id="profilingAspect" ref="profiler">
            <aop:pointcut id="serviceMethodWithReturnValue" expression="execution(!void x.y..*Service.*(..))"/>
            <aop:around method="profile" pointcut-ref="serviceMethodWithReturnValue"/>
        </aop:aspect>
    </aop:config>

    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@rj-t42:1521:elvis"/>
        <property name="username" value="scott"/>
        <property name="password" value="tiger"/>
    </bean>

    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

</beans>

上面配置的结果将获得到一个拥有剖析和事务方面的 按那样的顺序 应用于它上面的 'fooService' bean。 许多附加的方面的配置将一起达到这样的效果。

最后,下面的一些示例演示了使用纯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: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="fooService" class="x.y.service.DefaultFooService"/>

    <!-- the profiling advice -->
    <bean id="profiler" class="x.y.SimpleProfiler">
        <!-- execute before the transactional advice (hence the lower order number) -->
        <property name="order" value="1"/>
    </bean>

    <aop:config>

        <aop:pointcut id="entryPointMethod" expression="execution(* x.y..*Service.*(..))"/>

        <!-- will execute after the profiling advice (c.f. the order attribute) -->
       
        <aop:advisor advice-ref="txAdvice" pointcut-ref="entryPointMethod"order="2"/> 
        
        <!-- order value is higher than the profiling aspect -->

        <aop:aspect id="profilingAspect" ref="profiler">
            <aop:pointcut id="serviceMethodWithReturnValue" expression="execution(!void x.y..*Service.*(..))"/>
            <aop:around method="profile" pointcut-ref="serviceMethodWithReturnValue"/>
        </aop:aspect>

    </aop:config>

    <tx:advice id="txAdvice" transaction-manager="txManager">
        <tx:attributes>
            <tx:method name="get*" read-only="true"/>
            <tx:method name="*"/>
        </tx:attributes>
    </tx:advice>

    <!-- other <bean/> definitions such as a DataSource and a PlatformTransactionManager here -->

</beans>

上面配置的结果是创建了一个 'fooService' bean,剖析方面和事务方面被 依照顺序 施加其上。如果我们希望剖析通知在目标方法执行之前 后于 事务通知执行,而且在目标方法执行之后 先于 事务通知,我们可以简单地交换两个通知bean的order值。

如果配置中包含更多的方面,它们将以同样的方式受到影响。

9.5.8. 结合AspectJ使用 @Transactional

通过AspectJ切面,你也可以在Spring容器之外使用Spring框架的 @Transactional 功能。要使用这项功能你必须先给相应的类和方法加上 @Transactional注解,然后把 spring-aspects.jar 文件中定义的 org.springframework.transaction.aspectj.AnnotationTransactionAspect 切面连接进(织入)你的应用。同样,该切面必须配置一个事务管理器。你当然可以通过Spring框架容器来处理注入,但因为我们这里关注于在Spring容器之外运行应用,我们将向你展示如何通过手动书写代码来完成。

注意

在我们继续之前,你可能需要好好读一下前面的第 9.5.6 节 “使用 @Transactional” 和 第 6 章 使用Spring进行面向切面编程(AOP) 两章。

// construct an appropriate transaction manager 
DataSourceTransactionManager txManager = new DataSourceTransactionManager(getDataSource());

// configure the AnnotationTransactionAspect to use it; this must be done before executing any transactional methods
AnnotationTransactionAspect.aspectOf().setTransactionManager (txManager); 

注意

使用此切面(aspect),你必须在 实现 类(和/或类里的方法)、而 不是 类的任何所实现的接口上面进行注解。AspectJ遵循Java的接口上的注解 不被继承 的规则。

类上的 @Transactional 注解指定了类里的任何 public 方法执行的默认事务语义。

类里的方法的 @Transactional 将覆盖掉类注解的默认事务语义(如何存在的话)。 publicprotected和默认可见的方法可能都被注解。直接对 protected和默认可见的方法进行注解,让这些方法在执行时去获取所定义的事务划分是唯一的途径。

要把 AnnotationTransactionAspect 织入你的应用,你或者基于AspectJ构建你的应用(参考 AspectJ Development Guide),或者采取“载入时织入”(load-time weaving),参考 第 6.8.4 节 “在Spring应用中使用AspectJ Load-time weaving(LTW)” 获得关于使用AspectJ进行“载入时织入”的讨论。



本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Spring事务管理中@Transactional的参数配置 的相关文章

  • AsyncTask原理详解

    在Android中 xff0c 异步执行是很重要的一块内容 xff0c 诸如网络请求 xff0c 大图片的加载 xff0c 等待等耗时操作都要在后台线程执行 xff0c 而这些操作又要通过UI线程来调用 xff0c 这样我们不得不需要通过异
  • LinearLayout和RelativeLayout的特殊属性

    Relativelayout属性 xff1a 属性名称描述android layout centerHorizontal水平居中android layout centerVertical垂直居中android layout centerIn
  • Activity launchmode和Intent flag详解

    学习安卓 xff0c 首先就要接触和学习Activity xff0c 想必大家在学习activity的过程中一定对activity的launchmode有过困惑 好在网络上关于activity launchmode的博客 解释一大堆 xff
  • 利用Canvas saveLayer手动绘制圆角View

    项目中包含了一个腾讯地图 xff0c 由于腾讯地图mapView不支持圆角背景 xff0c so决定自己画四个圆角view CornerView xff0c 覆盖在mapView上以实现圆角矩形的效果 要实现这样的效果 xff0c 需要重新
  • java内部类总结

    内部类是指在一个外部类的内部再定义一个类 类名不需要和文件夹相同 内部类可以是静态static的 xff0c 也可用public xff0c default xff0c protected和private修饰 xff08 而外部顶级类即类名
  • Linux服务器下Java环境配置-详细

    环境 xff1a Linux环境 具体步骤 xff1a 1 首先查看当前服务器环境是否已配置了JAVA 命令 xff1a java version 2 开始配置 通过官网下载JDK文件 xff0c 地址 xff1a https www or
  • 常用的Java文件操作

    span class hljs comment 1 创建文件夹 span span class hljs comment import java io span File myFolderPath 61 span class hljs bu
  • IntentFilter

    当Intent在组件间传递时 xff0c 组件如果想告知Android系统自己能够响应和处理哪些Intent xff0c 那么就需要用到IntentFilter对象 顾名思义 xff0c IntentFilter对象负责过滤掉组件无法响应和
  • 虚拟机集群关机脚本

    集群关机脚本 当我们使用虚拟机的数量过多时候 xff0c 一一关机未免显得太过麻烦 xff0c 所以这里设计了一个简单的Shell集群关机脚本 xff1a 这里以三台为例 xff1a Linux4 Linux3 Linux2 bin bas
  • Redis3.0集群crc16算法php实现方法(php取得redis3.0集群中redis数据所在的redis分区插槽,并根据分区插槽取得分区所在redis服务器地址)

    数据分区 Redis集群将数据分区后存储在多个节点上 xff0c 即不同的分区存储在不同的节点上 xff0c 每个节点可以存储多个分区 每个分区在Redis中也被称为 hash slot xff0c Redis集群中总共规划了16384个分
  • 安装 Google play service

    Be Careful Follow these steps and save your time Right Click on your Project Explorer Select New gt Project gt Android A
  • [计算机网络] - HTTP、HTTPS

    本文转载自 xff1a https blog csdn net qq 34827674 article details 104732605 1 HTTP 基本概念 HTTP 是超文本传输协议 xff0c 也就是HyperText Trans
  • ffmpeg命令行使用

    查看视频信息 ffmpeg i 视频名字 视频名字这里输入前几个字符按 tab 键可以自动补全 返回结果 xff1a 红框之内的内容没什么用 编码器 xff1a encoder Lavf57 25 100 持续时间 xff1a Durati
  • 基于JAVA的志愿者管理系统(最新)

    个人毕业设计 xff0c 喜欢的私聊 目录 基于JAVA的志愿者管理系统 3 专业 xff1a 学号 xff1a 学生姓名 xff1a 指导老师 xff1a 3 1 引言 4 1 1 项目开发的背景 4 1 2本文的主要工作 5 1 3本课
  • 追风筝的人:变质的友谊

    每个人心中都有一段不可言说的故事 在我们的岁月里 xff0c 那些朋友玩伴早已经消失在了我们的生活之中 但是那些共同的记忆还保留在我们的心中 追风筝的人 这是一本描述友谊的书籍 xff0c 能够给我们的心灵带来一丝的慰籍 哈桑在一次逃避中
  • 题目:判断101-200之间有多少个素数,并输出所有素数。

    题目 xff1a 判断101 200之间有多少个素数 xff0c 并输出所有素数 分析 xff1a 不能被2整除的称为质数 错解 xff1a for int i 61 101 i lt 61 200 i 43 43 if i 2 61 0
  • iOS总结

    1 设置UILabel行间距 NSMutableAttributedString attrString 61 NSMutableAttributedString alloc initWithString label text NSMutab
  • 最大公约数

    题目 xff1a 输入两个正整数m和n xff0c 求其最大公约数 分析 使用辗转相除法 竞相减损法 比如36和24的最大公约数是12 36 24 61 12 24 12 61 0 xff1b 所以12是36和24的最大公约数 比如48和3
  • SpringMVC中可以判断Controller中传来的参数是否为空方法

    package org swinglife controller import org springframework stereotype Controller import org springframework web bind an
  • HashMap的简单使用之remove的使用(三)

    remove方法可以删除其中的属性值

随机推荐

  • 新手最应该看的Mybatis中xml的分页查询sql语句

    研究了一整天 xff0c 终于弄明白了 Mybatis中 xml 的分页查询 sql 语句 xff1a lt 根据页数进行排序 gt lt select id 61 34 selectStudentByMap 34 resultType 6
  • 王昕的 java 下Excel的导入和导出,数据校验

    Apache POI是Apache开发的开源的跨平台的 Java API xff0c 提供API给Java程序对Microsoft Office格式档案进行各种操作 POI中Excel操作很简单 xff0c 主要类有 HSSFWorkboo
  • ModuleNotFoundError: No module named 'urllib2'

    历尽千辛万苦 xff0c 终于在Eclipse上安装好了python的编译工具了 https blog csdn net zrcshendustudy article details 82120397 正准备来一个爬虫程序入门的时候 xff
  • AttributeError: module 'pip' has no attribute 'pep425tags'

    情境再现 xff1a AttributeError module 39 pip 39 has no attribute 39 pep425tags 39 分析问题 xff1a 百度可知是Win32和Win64的输入命令各有所不同 解决问题
  • maven中的pom导入jackson包存在的问题,miss the jar

    情境再现 xff1a 之前导Jackson包的时候 xff0c 一直在dependency处有个错号 xff0c 我之前导的是2 6 0版本 分析问题 xff1a 网上好多说是maven文件没有删除的问题 后来看到有人导了不一样的版本 xf
  • java求完数的三种方法

    package al 64 author zhangrichao 64 version 创建时间 xff1a 2019年1月6日 下午8 55 34 求完数 第一种方法 xff1a 减法方式 public class PerfectNumb
  • 用java实现快速排序算法

    第一种方法 xff1a xff08 从数组右边开始 xff09 1 选择一个比较值c xff0c 以数组的第一个为例 2 从右边开始查找比c小的值 xff0c 再从左边开始查找比c大的值 xff0c 进行互换 3 当左边和右边同时指向一个值
  • Spring MVC常用注解

    一 Spring MVC 常用注解 1 64 RequestMapping Spring MVC 通过 64 RequestMapping 注解将 URL 请求与业务方法进行映射 xff0c 在控制器的类定义处以及方法定义处都可以添加 64
  • 字符串通配符(递归)

    题目描述 问题描述 xff1a 在计算机中 xff0c 通配符一种特殊语法 xff0c 广泛应用于文件搜索 数据库 正则表达式等领域 现要求各位实现字符串通配符的算法 要求 xff1a 实现如下2个通配符 xff1a xff1a 匹配0个或
  • 数据结构 实验报告01

    一 实验目的和要求 完成尽可能多的数据排序 xff0c 并显示运行时间 二 实验环境 编译器 xff1a Vscode DevC 43 43 系统 xff1a Windows10 CPU xff1a i5 8265U 64 1 60GHz
  • eclipse中java代码自动补全设置

    下面介绍一个eclipse自动补全的设置1 在eclipse页面 xff0c 点击顶部的Window选项选择进入Preferences选项 xff1a 2 点击java gt Editor gt Content Assist选项 xff1a
  • Java两种方法去除字符串末尾的数字

    问题 xff1a 如何去除这个字符串中末尾的数字 xff1a sdf12 432fdsf gfdf32 xff1f 这个问题的解决关键是要先把字符串进行反转操作 方法一 xff1a public static String removeNu
  • The word 'jsp' is not correctly spelled. Eclipse 拼写检查出错处理办法

    The word 39 jsp 39 is not correctly spelled Eclipse 拼写检查出错处理办法 用Eclipse开发程序 xff0c 发现输入JSP时 xff0c 系统提示The word 39 jsp 39
  • prepareStatement与Statement的区别

    prepareStatement与Statement的区别 1 区别 xff1a stmt 61 conn CreateStatement resultSet rs 61 stmt executeQuery sql 上面是statement
  • Java集合类详解

    Collection List LinkedList ArrayList Vector Stack Set Map Hashtable HashMap WeakHashMap Collection接口 Collection是最基本的集合接口
  • MySQL字符集 GBK、GB2312、UTF8区别 解决 MYSQL中文乱码问题以及error 1406:data too long for column 'name' at row 1

    MySQL中涉及的几个字符集 character set server default character set xff1a 服务器字符集 xff0c 默认情况下所采用的 character set database xff1a 数据库字
  • 网页的基底网址

    基底网址的实质是统一设置超级链接的属性 xff0c 基底网址标签是 lt base gt 它有两个属性 xff0c href和 target href用于设置基底网址的路径 xff0c target用于设置超级外国链接的打开文式 通过基底网
  • Python实现word转pdf

    Python实现word转pdf 在做word转未pdf的功能过程中找了很多java的实现 xff08 POI xff09 xff0c 对于普通的文档还是支持的还可以 xff0c 但是对于文档里面涉及图片 表格 水印等就会出现很多样式上的问
  • Java遍历集合四种方法

    import java util ArrayList import java util Iterator import java util List public class Test public static void main Str
  • Spring事务管理中@Transactional的参数配置

    Spring作为低侵入的Java EE框架之一 xff0c 能够很好地与其他框架进行整合 xff0c 其中Spring与Hibernate的整合实现的事务管理是常用的一种功能 所谓事务 xff0c 就必须具备ACID特性 xff0c 即原子