This article is part of my blog series on automated testing promoting my new Pluralsight course Effective Automated Testing with Spring. Automated testing is an essential step in the development process (as covered in the first blog post in this series). Unfortunately, writing automated tests is often skipped because it’s difficult or there is a high maintenance cost associated with the tests written. …
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.
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…
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.
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…
While acknowledging that I still have much to learn about Spring Batch, I’d like to share my well-learned lessons in the world of restartability, including how to identify improper usage of Spring Batch’s Step & Job ExecutionContext and how to write good, wholesome components for Spring Batch…