spring-batch

Spring Batch CompositeItemProcessor get value from other delegates

巧了我就是萌 提交于 2021-02-11 14:40:35
问题 I have a compositeItemProcessor as below <bean id="compositeItemProcessor" class="org.springframework.batch.item.support.CompositeItemProcessor"> <property name="delegates"> <list> <bean class="com.example.itemProcessor1"/> <bean class="com.example.itemProcessor2"/> <bean class="com.example.itemProcessor3"/> <bean class="com.example.itemProcessor4"/> </list> </property> </bean> The issue i have is that within itemProcessor4 i require values from both itemProcessor1 and itemProcessor3. I have

Customize parameters of a step in Spring Batch application

喜你入骨 提交于 2021-02-11 12:41:17
问题 I am working with Spring Batch(using Spring boot). My requirement is to read data from db, process it(validations and stuffs) and write it to a file. I am trying to achieve this using a batch step. Problem is , if i define a step, the reader,processor and writer should be having similar parameters.(from examples i saw and the error i got) Like if my reader is returning a db domain object, the processor and writer should be having domain object parameters. What i am looking for is , reader

Customize parameters of a step in Spring Batch application

爱⌒轻易说出口 提交于 2021-02-11 12:40:52
问题 I am working with Spring Batch(using Spring boot). My requirement is to read data from db, process it(validations and stuffs) and write it to a file. I am trying to achieve this using a batch step. Problem is , if i define a step, the reader,processor and writer should be having similar parameters.(from examples i saw and the error i got) Like if my reader is returning a db domain object, the processor and writer should be having domain object parameters. What i am looking for is , reader

Test Spring batch with @JpaDataTest

∥☆過路亽.° 提交于 2021-02-11 12:32:33
问题 I'm using spring batch 4.0 and i'm trying to test my batch. I would use embedded database h2 with @JpaDataTest but it doesn't work. When i add this annotation i got error java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client). @Transaction(propagation=Propagation.NEW_REQUIRED) on the @Test dosen't work. I tried to copy every annotations from @JpaDataTest and remove @Transaction

Writing a JUnit test for a “Step” scoped bean - No scope registered for scope name “step” (Spring Batch 3.0.10)

蹲街弑〆低调 提交于 2021-02-11 08:09:09
问题 I want to write a JUnit test case for a Spring managed bean which has the scope as "step". This bean is refereed by a Spring Batch Tasklet. Bean defintion for configDAO ConfigDAOImpl class <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:batch="http://www.springframework.org/schema

Writing a JUnit test for a “Step” scoped bean - No scope registered for scope name “step” (Spring Batch 3.0.10)

走远了吗. 提交于 2021-02-11 08:06:03
问题 I want to write a JUnit test case for a Spring managed bean which has the scope as "step". This bean is refereed by a Spring Batch Tasklet. Bean defintion for configDAO ConfigDAOImpl class <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:batch="http://www.springframework.org/schema

Writing a JUnit test for a “Step” scoped bean - No scope registered for scope name “step” (Spring Batch 3.0.10)

一曲冷凌霜 提交于 2021-02-11 08:05:50
问题 I want to write a JUnit test case for a Spring managed bean which has the scope as "step". This bean is refereed by a Spring Batch Tasklet. Bean defintion for configDAO ConfigDAOImpl class <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:batch="http://www.springframework.org/schema

Spring batch multithreading: throttle-limit impact

余生长醉 提交于 2021-02-11 08:00:51
问题 I have a multi-threaded Step configured with a threadpool with a corePoolSize of 48 threads (it's a big machine) but I did not configure the throttle-limit . I am wondering if I have been under utilizaing the machine because of this. The Spring Batch documentation says that throttle-limit is the max amount of concurrent tasks that can run at one time and the default is 4 . I can see in jconsole that in fact there are 48 threads created and they seem to be executing (I can also see that in my

Exception “java.lang.IllegalStateException: Existing transaction detected in JobRepository.” after upgrading spring batch from 2.1.1 to 4.1.1 version

邮差的信 提交于 2021-02-11 05:54:38
问题 I have a Junit test case which run a batch job. Previously It was working when I have spring batch version 2.1.2. But once I upgraded to version 4.1.1, am getting below exception java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client). I have tried removing @Transactional from test class. But still getting an exception.I guess the error is due to two transactions. But still removal of

DDD and batch processing (e.g. using Spring batch)

对着背影说爱祢 提交于 2021-02-11 01:14:47
问题 I would like to use Spring batch for a batch application. I already have a domain model designed following DDD. My question is how batch processing (in my case, using Spring batch) fits with DDD? For example, I have an aggregate root A and one of its children is the entity B. A has a list of one or more Bs. The batch application receives a file when each line corresponds to an operation (add, delete...) on the list of Bs. In my aggregate root A, I have one method for each operation (e.g. addB