Spring Batch Simple Example Part 3

In this post I will explain how to combine the reader and writer in a job and how to run the job. We define a job which will transfer the employee records from one file to another file in batches. <batch:job id=”importEmployees”> <batch:step id=”readWriteEmployees”> <batch:tasklet> <batch:chunk reader=”reader” writer=”writer” commit-interval=”50″/> </batch:tasklet> </batch:step> </batch:job> <bean id=”transactionManager” class=”org.springframework.batch.support.transaction.ResourcelessTransactionManager”… Continue reading Spring Batch Simple Example Part 3

Spring Batch Simple Example Part 2

In this post, I will explain how to write the employee objects created in the reading process to a file. To write the list of employee records in batches, we need to create an instance of org.springframework.batch.item.file.FlatFileItemWriter. It takes two information 1) the resource file where the information has to be written 2) An instance… Continue reading Spring Batch Simple Example Part 2

BeanParam annotation example

This post will explain the use of BeanParam annotation in JAX-RS with an example. The purpose of BeanParam annotation is to consolidate all the user input (i.e., input through QueryParam, HeaderParam, FormParam, etc) and inject into a given class instance variables. Below is an example of webresource whose only method “retrieveRecord1” has a parameter annotated… Continue reading BeanParam annotation example

Configuring the Jsonb instance

From the previous posts we can see that an instance of Jsonb is used for serialization/deserialization of java objects to/from json format. We can configure the Jsonb instance by creating an instance of JsonbConfig. By default jsonb implementation provider must support the following properties to be configured. jsonb.to.json.formatted – java.lang.Boolean Controls whether or not the… Continue reading Configuring the Jsonb instance