Java-based health check for Docker
When you launch a container, Docker maintains its status as it transitions between several states. These states are tracked through the server events. Learn how to customize this behavior to more accurately provide health status of a Java application running on Tomcat.
Copying dependency files with Maven
Sometimes we need to move a dependency to the target directory along with the application JAR. These files may not be used by the application directly and hence wouldn't be packaged in the application's JAR as part of the build process. Learn how to do this while building the application with Maven.
Error handling for Spring Security Resource Server
Spring Boot provides useful defaults to handle exceptions and formulate a helpful response. However, in many cases, some customization might be needed. Learn how to accomplish this for a REST API protected with OAuth 2 using Spring Security Resource Server.
Protecting endpoints with Spring Security Resource Server
OAuth2 is the industry standard for providing authorization. Spring Security provides an OAuth2 Resource Server starter to implement an authorization layer. Learn how to implement a service-to-service authorization flow using client-credentials grant type and audience claim.
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 relatively straightforward way to cleanup unused resources using the prune command.
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. If we know that a failure lasts only for a short time, we may attempt to recover from it by using a retry pattern.
Logging methods with AspectJ in a Spring application
Method logging is a common pattern to collect data about a method. This could be execution time, the inputs and outputs of the method, etc. You can do this by using a logger but since this is a repetitive task, we'll look at how to automate it.
API Documentation with Springfox 3
Springfox v3 added support for OpenAPI 3 and Spring 5. It also comes with a ready-to-use Spring Boot starter which replaces a host of dependencies that were required in earlier versions. Learn how to use Springfox with a reactive Spring Boot project.
Using Git LFS in CI
Git LFS is the recommended way to version large binary files alongside the source code in Git. Your CI will pull these objects every time it runs the pipeline which can be a problem if you've limited bandwidth. What can you do get around this issue?
Parsing varargs as array with Jackson
Learn how to pass varargs using Jackson for a property on a Java class.