Private Constructors in Java
1. Introduction Private constructors allow us to restrict the instantiation of a class. Simply put, they prevent the creation of class instances in any place other than the class itself. Public and...
View Article3DES in Java
1. Introduction 3DES or Triple Data Encryption Algorithm is a symmetric-key block cipher that applies the DES cipher algorithm three times to each data block. In this tutorial, we'll learn how to...
View ArticleIntroduction to Spring Native
1. Overview Native images provide various advantages like an instant startup and reduced memory consumption. Therefore, at times, we might want to build a native image of our Java application. In this...
View ArticleCollection.toArray(new T[0]) or .toArray(new T[size])
1. Overview The Java programming language provides arrays and collections to group objects together. Mostly, a collection is backed by an array and modeled with a set of methods to process the elements...
View ArticleGenerating Alphanumeric UUID String in Java
1. Overview UUID (Universally Unique Identifier), also known as GUID (Globally Unique Identifier), is a 128-bit value that is unique for all practical purposes. Their uniqueness doesn't depend on a...
View ArticleEnabling Logging for Apache HttpClient
1. Overview In this tutorial, we'll show how to enable logging in Apache's HttpClient. Additionally, we'll explain how logging is implemented inside the library. Afterward, we'll show how to enable...
View ArticleCommon Shortcuts in Eclipse
1. Overview Many developers rely heavily on keyboard shortcuts to work efficiently in their IDE of choice. In this tutorial, we're going to learn about some of the common shortcuts in the popular...
View ArticleExpose More Than One Port With Docker
1. Overview When we dockerize our applications, we usually need to expose one port. The application uses that port to interact with other containers or the outside world. Sometimes, one port is not...
View ArticleLookahead and Lookbehind in Java Regex
1. Overview Sometimes we might face difficulty matching a string with a regular expression. For example, we might not know what we want to match exactly, but we can be aware of its surroundings, like...
View ArticleJava Weekly, Issue 392
1. Spring and Java >> Internal JDK Elements Strongly Encapsulated in JDK 17 [infoq.com] Illegal access to internal APIs is no longer an option as of Java 17 – must know if we're planning to use...
View ArticleDifference Between Maven Surefire and Failsafe Plugins
1. Overview In typical Test Driven Development, we aim to write lots of low-level unit tests that are fast to run and set up in isolation. Additionally, there are also few high-level integration tests...
View ArticleKubernetes Deployment vs. StatefulSets
1. Overview Kubernetes (K8s) is an open-source container orchestration system. It allows us to automate deployments, scale, and manage containerized applications. In this tutorial, we'll discuss two...
View ArticleSwagger @Api Description Is Deprecated
1. Overview Describing a RESTful API plays an important role in the documentation. One common tool used to document REST APIs is Swagger 2. However, one useful attribute used for adding a description...
View ArticleJPA Entities and the Serializable Interface
1. Introduction In this tutorial, we'll discuss how JPA entities and the Java Serializable interface blend. First, we'll take a look at the java.io.Serializable interface and why we need it. After...
View ArticleDifferent Serialization Approaches for Java
1. Overview Serialization is the process of converting an object into a stream of bytes. That object can then be saved to a database or transferred over a network. The opposite operation, extracting an...
View Article“Code too large” Compilation Error in Java
1. Overview When a Java method exceeds 65535 bytes, we get the compilation error, “code too large”. In this article, we'll discuss why this error occurs and how to fix it. 2. JVM Constraints The...
View ArticleConverting Camel Case and Title Case to Words in Java
1. Overview Strings commonly contain a mixture of words and other delimiters. Sometimes, these strings may delimit words by a change in case without whitespace. For example, camel case capitalizes each...
View ArticleStart Two Threads at the Exact Same Time in Java
1. Overview Multi-thread programming allows us to run threads concurrently, and each thread can handle different tasks. Thus, it makes optimal use of the resources, particularly when our computer has a...
View ArticleSend Large Messages With Kafka
1. Overview Apache Kafka is a powerful, open-source, distributed, fault-tolerant event streaming platform. However, when we use Kafka to send messages larger than the configured size limit, it gives an...
View ArticleThe java.lang.NoClassDefFoundError in JUnit
1. Overview In this article, we'll understand why the java.lang.NoClassDefFoundError occurs in JUnit and how to fix it. This issue is mainly related to IDE's configurations. Therefore, we'll be...
View Article