为什么弹簧集成和批处理事务的每个方法(弹簧批处理作业)的默认隔离级别设置为SERIALIZABLE?

Mas*_*ues 5 transactions spring-integration spring-batch

我有一个spring集成+批处理应用程序.

集成用于使用inboun通道适配器读取文件并调用批处理作业.jobRepository定义于:org.springframework.batch.core.repository.support.JobRepositoryFactoryBean

事务管理器是org.springframework.orm.jpa.JpaTransactionManager.

当应用程序启动时,我不知道为什么,但我读了这种奇怪的配置:

[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [*] with attribute [PROPAGATION_REQUIRED,ISOLATION_DEFAULT]
[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [create*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE]
[5860] [2012-03-12 17:40:47,267] D [main] [org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource] Adding transactional method [getLastJobExecution*] with attribute [PROPAGATION_REQUIRES_NEW,ISOLATION_SERIALIZABLE]
Run Code Online (Sandbox Code Playgroud)

似乎默认情况下,每个jobmethod都配置了隔离SERIALIZABLE,但我没有设置它.知道如何将默认隔离级别设置为ISOLATION_DEFAULT吗?

Gar*_*ell 4

默认情况下它是可串行化的,以防止同一作业实例在 2 个或更多机器上同时执行。如果您不担心这个问题,您可以放松一下。

http://static.springsource.org/spring-batch/reference/html/configureJob.html#txConfigForJobRepository

isolation-level-for-create
Run Code Online (Sandbox Code Playgroud)

属性控制 create* 和 getLastJobExecution* 方法的传播