Encrypting Working Files Locally in Spring Batch

Rik Scarborough Java, Spring, Spring Batch, Technology Snapshot Leave a Comment

It seems that quite often we read stories in the news about computer systems being cracked and data being compromised. It’s a growing concern that should be a consideration for everyone in Information Technology. There is probably not just one solution that will keep all data safe, but hopefully small efforts in many areas will provide us with the best possible solution.

In this post, I show a solution for encrypting sensitive files for local use with Java’s Encryption library & tying directly into Spring Batch readers and writers.

The Scenario
Recently we began writing a Spring Batch application that would handle sensitive data. The application servers were set up with some very good, basic security, but we felt the data could use some extra protection.

The data would be delivered to the company on a well-protected and secure FTP server. Mark Fricke did an excellent post recently on Spring Integration and Spring Batch in which he discusses downloading an encrypted file from a FTP server and decrypting it. Unfortunately, this was not exactly the problem we had. We needed to download a unencrypted file, but never write it to the Application Server unencrypted. But, we needed to be able to read that file and process it in Spring Batch.

Using Java’s built-in cryptography, we are able to extend Spring Batch to encrypt the file on the disk and then read that file in a Spring Batch Reader. In addition, we can write the results out as an encrypted file then transfer that file back to the secure FTP server as clean text.

Wow, that sounds like a lot and will be a really complex solution. Actually the code turned out to not be all that complex. This solution relies partly on the Delegate Pattern I wrote about before, so I will be using the same code I developed for that and just showing the changes here. Please refer back to the original post…



Using Spring Integration In Conjunction With Spring Batch

Mark Fricke JavaScript, Spring, Spring Batch, Technology Snapshot 1 Comment

Recently I was working on a development project for a client focused on Spring Batch. The program required a pull of the SFTP directory for an encrypted file, decryption of that file, starting of the Spring Batch program, and archive of that file.

Initially, my first thought was to use a shell script to perform all the tasks. Then one of my colleagues suggested Spring Integration; I thought this was great opportunity to learn and get my hands dirty with something new.

In this blog, I will show an example of Spring Integration configuration code, break it apart, and show how each part works.

Spring Integration turned out to be a simple solution to my client’s needs. Using Spring Integration and Spring Batch with Spring Boot, I was able to have a single deployable jar that included everything to run the application. I no longer needed separate deployments for the shell script, and batch process and all code is one Java project.



Migrating to Java 9

Billy Korando Java, Programming, Spring, Technology Snapshot Leave a Comment

Java 9, after many delays and failed votes, looks to be finally arriving this September.

Java 9 will bring several new features: enhancements to Streams, a REPL, improvements to Collections, among others. But by far the biggest and most controversial change is Jigsaw. Jigsaw is introducing modularity to the JDK, a long topic in and of itself, but it is one of the major reasons upgrading to Java 9 will be more difficult than previous major releases of Java.

In this blog we will take a look at some of the benefits of running in a Java 9 environment, how to migrate a Spring Boot application to Java 9, and finally review some of the common problems you may run into and strategies for resolving them…



Spring Boot – The Right Boot For You!

Matt McCandless Java, Spring, Technology Snapshot, Tutorial Leave a Comment

Need a little spring in your step? Tired of all those heavy web servers and deploying WAR files? Well you’re in luck.

Spring Boot takes an opinionated view of building production-ready Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible.

The aim of this blog is just to get you familiar with how to get Spring Boot going on your machine. It is going to be fairly straightforward and vanilla. The goal is to get you started…