Blog

Guides, notes and opinion pieces
guide∼5 min
Creating deep copies in Java
The need to create copies is pretty common in programming. In a nutshell, you may need the copy of an object's reference (called a shallow copy) or the copy of the object's data (called a deep copy),...
note∼2 min
Converting TTF files to WOFF and WOFF2
Recently, I came across a font that I wanted to use on a web application. By default, I usually rely on woff2 and woff formats to load webfonts. However, the said font was available only in TTF...
guide∼6 min
Java-based health check for Docker
When you launch a container, Docker maintains its status as it transitions between several states. When you list the containers (using docker ps or docker container ls), the status of those states is...
note∼2 min
Copying dependency files with Maven
Sometimes, when I build an application with Maven, I need to move some dependency files to the target directory along with the application JAR. These files may not be used by the application directly...
guide∼5 min
Error handling for Spring Security Resource Server
This is a follow-up post for Error handling for a Spring-based REST API and Protecting endpoints with Spring Security Resource Server. In this post, we'll discuss how to customize error handling...
guide∼18 min
Protecting endpoints with Spring Security Resource Server
In any modern application, you'll encounter multiple services talking to each other and even communicating with third-party services to provide useful functionalities. Some of these services may...
note∼1 min
Cleaning up Docker resources
In good old days, we used to write scripts to cleanup stale Docker containers, images, volumes, etc. Docker Engine 1.25 provided a welcome change on this. Now, there's a relatively straightforward...
guide∼11 min
Retrying on failure with Resilience4J and Aspects
Failure is an inevitability in a complex distributed system. A service may time out, a filesystem may run out of space or an API endpoint may be unavailable because of a failed deployment. Regardless...
guide∼12 min
Logging methods with AspectJ in a Spring application
Method logging is a very common pattern that helps a developer verify which method has started executing and when it has finished. It can also be used to log the time a method takes to finish...
guide∼5 min
API Documentation with Springfox 3
Recently, the popular Springfox project released the long-awaited v3 of their library with support for OpenAPI 3 and Spring 5 (only annotation-based API is supported). It also comes with a...