Health Indicators in Spring Boot
1. Overview Spring Boot provides a few different ways to inspect the status and health of a running application and its components. Among those approaches, the HealthContributor and HealthIndicator...
View ArticleUsing application.yml vs application.properties in Spring Boot
1. Overview A common practice in Spring Boot is using an external configuration to define our properties. This allows us to use the same application code in different environments. We can use...
View ArticleWeb Server Graceful Shutdown in Spring Boot
1. Overview In this quick tutorial, we're going to see how we can configure Spring Boot applications to handle shutdowns more gracefully. 2. Graceful Shutdown As of Spring Boot 2.3, Spring Boot now...
View ArticleReading a Line at a Given Line Number From a File in Java
1. Overview In this quick article, we're going to look at different ways of reading a line at a given line number inside a file. 2. Input File Let's start by creating a simple file named inputLines.txt...
View ArticleSpring MVC Async vs Spring WebFlux
1. Introduction In this tutorial, we'll explore the @Async annotation in Spring MVC, and then we'll get familiar with Spring WebFlux. Our goal is to have a better understanding of the difference...
View ArticleHow to Turn Off Swagger-ui in Production
1. Overview The Swagger user interface allows us to view information about our REST services. This can be very convenient for development. However, owing to security concerns, we might not want to...
View ArticleIntroduction to ArchUnit
1. Overview In this article, we'll show how to check the architecture of a system using ArchUnit. 2. What is ArchUnit? The link between architecture traits and maintainability is a well-studied topic...
View ArticleCustomizing the Login Page for Keycloak
1. Overview Keycloak is a third-party authorization server used to manage our web or mobile applications' authentication and authorization requirements. It uses a default login page to sign-in users on...
View ArticleJava Weekly, Issue 348
1. Spring and Java >> Seeing Register Allocation Working in Java [chrisseaton.com] An insightful and in-depth take on how GraalVM allocates variables in machine registers. >> Logging In...
View ArticleIntroduction to keytool
1. Overview In this short tutorial, we're going to introduce the keytool command. We'll learn how to use keytool to create a new certificate and check the information for that certificate. 2. What Is...
View ArticleListing Kafka Topics
1. Overview In this quick tutorial, we're going to see how we can list all topics in an Apache Kafka cluster. First, we'll set up a single-node Apache Kafka and Zookeeper cluster. Then, we'll ask that...
View ArticleLargest Power of 2 That Is Less Than the Given Number
1. Overview In this article, we'll be seeing how to find the largest power of 2 that is less than the given number. For our examples, we'll take the sample input 9. 20 is 1, the least valid input for...
View ArticleIllegalArgumentException or NullPointerException for a Null Parameter?
1. Introduction Among the decisions we make as we're writing our applications, many are about when to throw exceptions and which type to throw. In this quick tutorial, we're going to tackle the issue...
View ArticleTesting Quarkus Applications
1. Overview Quarkus makes it very easy these days to develop robust and clean applications. But how about testing? In this tutorial, we'll take a close look at how a Quarkus application can be tested....
View ArticleGradle Source Sets
1. Overview Source sets give us a powerful way to structure source code in our Gradle projects. In this quick tutorial, we're going to see how to use them. 2. Default Source Sets Before jumping into...
View ArticleGuide to ArrayStoreException
1. Overview ArrayStoreException is thrown at runtime in Java when an attempt is made to store the incorrect type of object in an array of objects. Since ArrayStoreException is an unchecked exception,...
View ArticleAssert Two Lists for Equality Ignoring Order in Java
1. Overview Sometimes when writing unit tests, we need to make order agnostic comparison of lists. In this short tutorial, we'll take a look at different examples of how we can write such unit tests....
View ArticleThe Spring @ConditionalOnProperty Annotation
1. Overview In this short tutorial, we're going to shed light on the main purpose of the @ConditionalOnProperty annotation. First, we'll start with a bit of background about what @ConditionalOnProperty...
View ArticleListing Kafka Consumers
1. Overview In this quick tutorial, we'll learn how to list Kafka consumer groups and also take a peek at their details. 2. Prerequisites To run the examples in this tutorial, we'll need a Kafka...
View ArticleGuide to @DynamicPropertySource in Spring
1. Overview Today's applications don't live in isolation: we usually need to connect to various external components such as PostgreSQL, Apache Kafka, Cassandra, Redis, and other external APIs. In this...
View Article