Spring Batch Java Config事务 - 属性等价 [英] Spring Batch Java Config transaction-attributes equivalent
本文介绍了Spring Batch Java Config事务 - 属性等价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Spring批处理中,您可以设置事务隔离
和传播
,如下所示:
In Spring batch you can set the transaction isolation
and propagation
like this:
<job id="someJob" xmlns="http://www.springframework.org/schema/batch">
<step id="readWriteDate">
<tasklet transaction-manager="transactionManager">
<transaction-attributes isolation="DEFAULT" propagation="REQUIRED" timeout="30"/>
<chunk reader="dbItemReader" processor="dbItemProcessor" writer="dbItemWriter"
commit-interval="2" />
</tasklet>
</step>
</job>
我找不到相同的java配置。
I cant find the java config equivalent.
推荐答案
好吧它就在那里
@Configuration
public class StepWithTx {
@Autowired
private StepBuilderFactory steps;
@Bean
public Step step() throws Exception {
return steps
.get("CustomTxStep")
.<String, String>chunk(10)
.transactionAttribute(transactionAttribute...)
.reader(reader...)
.processor(processor...)
.writer(writer...)
.build();
}
}
这篇关于Spring Batch Java Config事务 - 属性等价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文