About the Author
Jonny Hackett

Jonny Hackett

Twitter

Jonny is a Senior Software Engineer and Mentor with 15+ years of experience in IT. As an avid SportingKC fan, Jonny is a Java Developer and our resident Spring Batch expert.

Spring Batch for XML

Spring Batch: Using JAXB And StaxEventItemWriter To Generate XML

Jonny Hackett Articles, Java, Spring, 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.

Spring Batch Testing & Mocking Revisited with Spring Boot

Jonny Hackett Articles, Development Technologies & Tools, 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 Articles, Development Technologies & Tools, 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.

Spring Batch: Multiple Format Output Writer

Jonny Hackett Articles, Java, Spring, Spring Batch 1 Comment

Attention: This article was published over 10 years ago, and the information provided may be aged or outdated. While some topics are evergreen, technology moves fast, so please keep that in mind as you read the post.Being a strong advocate of Spring Batch, I’ve always talked about the notion of Spring Batch providing developers with a framework that allows them …

Spring Batch โ€“ Replacing XML Job Configuration With JavaConfig

Jonny Hackett Articles, Development Technologies & Tools, Java, Spring, Spring Batch 7 Comments

Attention: This article was published over 11 years ago, and the information provided may be aged or outdated. While some topics are evergreen, technology moves fast, so please keep that in mind as you read the post.I recentlyย assisted a client inย getting up and running with a Spring Batch implementation. The team had decided to move forward with a JavaConfig-based configuration …