How to Tear Down or Empty HSQLDB Database After Test
1. Overview When writing integration tests, maintaining a clean database state between tests is crucial for ensuring reproducible results and avoiding unintended side effects. HSQLDB (HyperSQL...
View ArticleHow to Convert OpenAPI 2.0 to OpenAPI 3.0 in Java
1. Introduction Although the OpenAPI 3.x Specification has been available since 2017 and has gone through several updates, many APIs continue using older versions. In this tutorial, we’ll explore the...
View ArticleJava Weekly, Issue 566
1. Spring and Java >> Let’s use OpenTelemetry with Spring [spring.io] A solid look at how Spring integrates the OpenTelemetry protocol in the strong observability track within the Spring...
View ArticleHow to Handle “MysqlDataTruncation: Data truncation: Data too long for column”
1. Overview The Java Database Connectivity (JDBC) Application Programming Interface (API) provides a set of classes and interfaces. We can use these to connect to data sources such as relational...
View ArticleConnecting to Remote MySQL Database Through SSH Using Java
1. Overview Secure Shell (SSH) allows us to securely access and manage remote systems, including executing commands, transferring files, and tunneling services. We can establish a connection to a...
View ArticleComparison of HSSFWorkbook, XSSFWorkbook, and SXSSFWorkbook in Apache POI
1. Overview Apache POI is an open-source library that allows us to work programmatically with Microsoft Office documents, including Excel. Apache POI has three different classes that can be used to...
View ArticleSign CSR Using Bouncy Castle
1. Overview Signing a Certificate Signing Request (CSR) is a common operation in cryptography. In this tutorial, we’ll learn how to sign a CSR using the Bouncy Castle library. 2. Signing a CSR Signing...
View ArticleFinding IP Address of a URL in Java
1. Overview The Internet Protocol address – IP – is a unique identifier assigned to each device connected to a computer network. It allows devices to communicate with each other over the Internet. In...
View ArticlePass Collection as Varargs Argument
1. Overview In this tutorial, we’ll explore different approaches to supply a Collection as an argument for a varargs parameter. 2. What’s a Varargs Parameter? Variable arguments, or varargs for short,...
View ArticleHow to use virtual threads with ScheduledExecutorService
1. Introduction Virtual threads are a useful feature officially introduced in JDK 21 as a solution to improve the performance of high-throughput applications. However, the JDK has no built-in...
View ArticleFind by Property of a Nested Object in Spring Data
1. Overview In Spring Data, it’s common to query entities using derived queries based on method names. When dealing with relationships between entities, such as nested objects, Spring Data provides...
View ArticleFilter a List by Nested Lists in Java
1. Introduction In this tutorial, we’ll explore how to filter a list that contains nested lists in Java. When working with complex data structures, such as lists of objects that contain other lists, it...
View ArticleJava Date and Calendar: From Legacy to Modern Approaches
1. Overview Handling date and time is a fundamental part of many Java applications. Over the years, Java has evolved in dealing with dates, introducing better solutions to simplify things for...
View ArticleConsuming Messages in Batch in Kafka Using @KafkaListener
1. Overview In this tutorial, we’ll discuss handling Kafka messages in batches with Spring Kafka library’s @KafkaListener annotation. Kafka broker is a middleware that helps persist messages from...
View ArticleIntroduction to JetBrains Xodus
1. Overview Xodus is an open-source embedded database built by JetBrains. We can use it as an alternative to relational databases. Using Xodus we obtain a high-performance transactional key-value store...
View ArticleJava Weekly, Issue 567
1. Spring and Java >> Exploring New Features in JDK 23: Module Design Pattern with JEP-476 [foojay.io] JDK 23 brings module imports as a preview feature, intending to simplify the import of...
View ArticleIntroduction to JavaMelody
1. Introduction As application developers, we generally build complex business logic as efficiently as possible. However, once these applications are in production, we would also like to gather runtime...
View ArticleConnect to Oracle Database with JDBC Driver
1. Overview The Oracle Database is one of the most popular relational databases. In this tutorial, we’ll learn how to connect to an Oracle Database using a JDBC Driver. 2. The Database To get us...
View ArticleMockito Answer API: Returning Values Based on Parameters
1. Introduction Mocking is a testing technique that replaces real components with objects that have predefined behavior. This allows developers to isolate and test specific components without relying...
View ArticleIntroduction to Lanterna
1. Introduction Lanterna is a library for building text-based user interfaces, giving us similar abilities to the Curses C library. However, Lanterna is written in pure Java. It also gives us the...
View Article