Spring batch is part of the Spring framework and comes in handy when you
need to process large amount of records. These operations are most of the
time time-based. For example, you need to do some calculations at the
end of each month. The technology uses a reader to read data, the data
will be processed by a processor and it uses a writer to write everything to
the database. Because Spring batch is part of the Spring family, it uses the
same principles as Spring. Like Spring, it uses dependency injections. You
have to define everything in an xml file.
@BatchTestPlaceHolder: This annotation injects a batch Test in the field.
@BatchTestEnvironment: You can set a following parameters:
contextFile: You should give the name of the Spring application context.
parameter: The parameter to send with the job execution, allowing for testing multiple new executions
of same job. If true it will send simply a date to the batch execution. If true and the jobParameters are filled in,
then it will take those parameters.
job: You must choose a job out of the Spring application context.
exitCode: The default is 0 and the test will fail if the expected code doesnt match the actual code.
jobParameters: The jobParameters to send to the job execution. If they are not empty they will be used.
option: The option to send with the job execution, allowing for testing restart for instance, default it is set to none, meaning no options will be sent to the job execution.
In this example, the field batch will be injected with a new object of
a class that implement the interface BatchTest. In the first example
(testSuccess) we gve configured that the Spring context file is batchTest.xml and the job is successfulJob. So when the test begins, the
context file will be loaded and when we call the launchJob(), successfulJob will be executed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Batchmodule
Spring batch is part of the Spring framework and comes in handy when you
need to process large amount of records. These operations are most of the
time time-based. For example, you need to do some calculations at the
end of each month. The technology uses a reader to read data, the data
will be processed by a processor and it uses a writer to write everything to
the database. Because Spring batch is part of the Spring family, it uses the
same principles as Spring. Like Spring, it uses dependency injections. You
have to define everything in an xml file.
Batch Module load artifact
Batch Module project config.
Example
annotations:
of same job. If true it will send simply a date to the batch execution. If true and the jobParameters are filled in,
then it will take those parameters.
In this example, the field batch will be injected with a new object of
a class that implement the interface BatchTest. In the first example
(testSuccess) we gve configured that the Spring context file is batchTest.xml and the job is successfulJob. So when the test begins, the
context file will be loaded and when we call the launchJob(), successfulJob will be executed.