Spring Batch for XML

Spring Batch: Using JAXB And StaxEventItemWriter To Generate XML

Jonny Hackett Java, Spring Batch, Tutorial 2 Comments

While working with a client recently, my team was given the task to retrieve the held securities and account data from the system and export it to XML with the goal of importing it into another external system. The solution involved building a Spring Batch job that would read a set held security data, export that to XML data, and deliver the file to the external vendor securely.

In this blog, I’ll be giving a tutorial on how to execute this solution. These requirements form the basis for the example we’ll use.

Large Datasets with Spring Batch

Utilizing Spring Batch for Large Dataset Summarization

Clayton Neff Databases, Java, Spring, Spring Batch Leave a Comment

Attention: The following article was published over 4 years ago, and the information provided may be aged or outdated. Please keep that in mind as you read the post.I was recently tasked with summarizing the data of a several-million-row table, and the task proved to be a bit grueling at first. Eventually, I found a way to summarize the large …

Spring Batch to AWS Cloud: Transferring with Ease

Transferring Spring Batch Apps to AWS Cloud

Rik Scarborough AWS, Cloud, Development Technologies, Spring, Spring Batch, Tutorial 2 Comments

The last few years have seen a lot of movement to bring applications that don’t require manual intervention from the mainframe to Unix, Linux, Windows servers, or even to the desktop. This concept is commonly known as batch programming, and Spring Batch has been the tool many of us are using to accomplish this. Another trend that is gaining steam is to move from an internally-hosted server to a cloud-hosted system.

In this post, we discuss multiple ways for transferring Spring Batch applications up to the AWS Cloud, including EC2, Docker, Lambda, and others. I concentrate on AWS in this post, but, from my experience in Google Cloud, the same ideas will apply…

Spring Batch Testing & Mocking Revisited with Spring Boot

Jonny Hackett Development Technologies, Java, Spring, Spring Batch, Spring Boot, Testing 3 Comments

Several years ago, 2012 to be precise, I wrote an article on an approach to unit testing Spring Batch Jobs. My editors tell me that I still get new readers of the post every day, so it is time to revisit and update the approach to a more modern standard.

The approach used in the original post was purely testing the individual pieces containing any business logic. Back then, we didn’t have some of the mocking capabilities that we have today, so I went with an approach that made sense at the time.

However, there have been a few improvements in the past several years. One of those improvements has been the ability to Mock beans within a Spring Context. That’s where the @MockBean annotation comes to the rescue.

Using Apache POI With Protected Excel Files

Jonny Hackett Development Technologies, Java, Spring Batch 1 Comment

While working on a recent project at a client, we had the opportunity to refactor some data extracts that were using a commercial Excel writing library, which we then converted to using the Apache POI Library for Excel. These data extracts were reports that included some calculated values, and depending on the client, were required to be password protected. When completed, the reports would be emailed to the recipients configured for each client.

In this post, we discuss the challenge of delivering protected Microsoft documents via email. We introduce a Java code solution for emailing password-protected Excel files when using the Apache POI Library.

Some of the required calculations we chose to implement using Excel formulas. Implementing formulas wasn’t a hard task and worked for what was needed.