Working with Enums in Thymeleaf
1. Introduction In this quick tutorial, we’re going to learn how to work with enums in Thymeleaf. We’ll start by listing enum values in a dropdown. After that, we’ll look at using our enum for flow...
View ArticleHow to Reverse a String in Java
1. Overview In this quick tutorial, we’re going to see how we can reverse a String in Java. We’ll start to do this processing using plain Java solutions. Next, we’ll have a look at the options that the...
View ArticleThe Spring @Qualifier Annotation
1. Overview In this article, we’ll explore what the @Qualifier annotation can help us with, which problems it solves, and how to use it. We’ll also explain how it’s different from the @Primary...
View ArticleOverride Properties in Spring’s Tests
1. Overview In this tutorial, we’ll have a look at various ways to override properties in Spring’s tests. Spring actually provides a number of solutions for this, so we have quite a bit to explore...
View ArticleRemoving an Element from an Array in Java
1. Overview In this quick tutorial, we will learn about the various ways in which we can remove an element from an array in Java using the Apache Commons Lang library. 2. Maven Let’s add the...
View ArticleGuide to Java BiFunction Interface
1. Introduction Java 8 introduced functional style programming, allowing us to parameterize general-purpose methods by passing in functions. We’re probably most familiar with the single-parameter Java...
View ArticleMatrix Multiplication in Java
1. Overview In this tutorial, we’ll have a look at how we can multiply two matrices in Java. As the matrix concept doesn’t exist natively in the language, we’ll implement it ourselves, and we’ll also...
View ArticleDisable Spring Data Auto Configuration
1. Introduction In this quick tutorial, we’ll explore two different ways to disable database auto-configuration in Spring Boot, which can come in handy, say, when testing. We’ll see examples for Redis,...
View ArticleAdding Copyright License Header for Java Source Files in Eclipse
1. Overview Adding a copyright license header for source files in the Eclipse IDE is known to be a difficult and error-prone task. In this tutorial, we’ll learn two ways to make this task easy and...
View ArticleConverting a Kotlin File to Java
1. Overview Kotlin is well-known for its interoperability with Java. This is possible because they both are running on the Java Virtual Machine. In other words, they are compiled to the same bytecode....
View ArticleCompare Two JSON Objects with Jackson
1. Overview In this article, we’ll have a look at comparing two JSON objects using Jackson – a JSON processing library for Java. 2. Maven Dependency First, let’s add the jackson-databind Maven...
View ArticleJava Weekly, Issue 289
Here we go… 1. Spring and Java >> Explore the project on start.spring.io [spring.io] A cool new tool where you can take a peek at generated project files without having to actually download and...
View ArticleQuick Guide to EasyRandom in Java
1. Overview In this tutorial, we’ll show how to generate Java objects with the EasyRandom library. 2. EasyRandom In some cases, we need a set of model objects that we’ll use for testing purposes. Or,...
View ArticleGuide to Spring Cloud Stream with Kafka, Apache Avro and Confluent Schema...
1. Introduction Apache Kafka is a messaging platform. With it, we can exchange data between different applications at scale. Spring Cloud Stream is a framework for building message-driven applications....
View ArticleRemote Code Execution with XStream
1. Overview In this tutorial, we’ll dissect a Remote Code Execution attack against the XStream XML serialization library. This exploit falls into the untrusted deserialization category of attacks....
View ArticleJUnit Custom Display Name Generator API
1. Overview JUnit 5 has good support for customizing test class and test method names. In this quick tutorial, we’ll see how we can use JUnit 5 custom display name generators via the...
View ArticleUpload and Retrieve Files Using MongoDB and Spring Boot
1. Overview In this tutorial, we’ll discuss how to upload and retrieve files using MongoDB and Spring Boot. We’ll use MongoDB BSON for small files and GridFS for the larger ones. 2. Maven Configuration...
View ArticleNon-blocking Spring Boot with Kotlin Coroutines
1. Overview Kotlin Coroutines can often add readability to reactive, callback-heavy code. In this tutorial, we’ll find out how to leverage these coroutines for building non-blocking Spring Boot...
View ArticleMockMvc Kotlin DSL
1. Overview In this quick tutorial, we’ll have a look at the new Kotlin-specific MockMvc support available in Spring Framework 5.2+. Note: as version 5.2 is not GA yet, we need to use the Spring...
View ArticleLossy Conversion in Java
1. Overview In this quick tutorial, we’ll discuss the concept of lossy conversion in Java and the reason behind it. At the same time, we’ll explore some handy conversion techniques to avoid this error....
View Article