JSON (JavaScript Object Notation) has become a widely used data interchange format due to its simplicity, readability, and compatibility with various programming languages, including Java. It allows developers to represent structured data in a lightweight and human-readable format. In Java applications, JSON is commonly used for data storage, configuration files, and API communication. The objective…
Read More Java: Convert JSON to a Map
Accessing elements from an ArrayList is a fundamental operation in Java programming. ArrayLists are commonly used to store and manage collections of objects dynamically. Being able to retrieve elements enables you to work with the data stored within the ArrayList effectively. Whether you need to display elements, perform calculations, or manipulate the data in any…
Read More How to Get an Element from an ArrayList in Java?
In this tutorial, you will learn how to convert a JSON array to a Java list using a powerful Java library called Jackson. By the end of this tutorial, you will have a solid understanding of various methods available to achieve this conversion, allowing you to extract meaningful data from JSON arrays and leverage them…
Read More Convert JSON Array to Java List using Jackson
The purpose of this tutorial is to provide a comprehensive guide on updating keys in a HashMap in Java. As Java developers, we often encounter situations where we need to modify the keys associated with certain values in a HashMap. This tutorial aims to equip you with various methods and techniques to update keys efficiently…
Read More Java: Updating Keys in a HashMap
In Java, data types define the nature of variables and the kind of values they can hold. This is important because Java is a statically-typed language, which means that variables must be declared with their specific data types before they can be used. To accommodate this, Java provides a rich set of data types to…
Read More Convert Int to Long in Java
When working with strings in Java, it is essential to check if a string is null or empty. A null string refers to the absence of any value, while an empty string is a string with zero characters. Failing to handle null or empty strings appropriately can lead to unexpected errors and undesired behavior in…
Read More Check if String is Null or Empty in Java
Finding the maximum and minimum values in an array is a common requirement in various programming scenarios. It allows you to extract key insights from your data, such as identifying the highest and lowest values, or determining the range of values present. This knowledge can be utilized in numerous applications, including statistical analysis, data processing,…
Read More Finding Max and Min Values in a Java Array
JSON (JavaScript Object Notation) is a lightweight data-interchange format that has gained significant popularity in modern web development. It provides a simple and human-readable way to represent structured data. JSON consists of key-value pairs and supports various data types, including strings, numbers, booleans, arrays, and nested objects. The importance of JSON lies in its ability…
Read More Convert Java Objects to JSON
The java.lang.UnsupportedClassVersionError is a runtime error in Java that occurs when a Java Virtual Machine (JVM) encounters a class file with a version that is not supported by the JVM. This error typically arises when there is a mismatch between the version of the JVM executing the code and the version in which the class…
Read More How to Resolve java.lang.UnsupportedClassVersionError?
In this tutorial, I will share with you how to implement user look-up and authentication using Keycloak’s User Storage SPI. For starters, SPI stands for Service Provider Interface, and it is a way to write extensions to Keycloak to connect to external user databases and credential stores. In this tutorial, we will make Keycloak load…
Read More Keycloak User Storage SPI Example with Remote Service
This tutorial will guide you through the process of running Unit Tests and Integration Tests separately in a Maven-based Spring Boot application. We will use the JUnit Tag feature to group our test cases and separate Unit Tests from Integration Tests. To learn more, check out the Test Java code tutorials page. Create your tests…
Read More Running Unit Tests and Integration Tests Separately in Spring Boot
In this tutorial, you will learn how to use the @Tag annotation in JUnit 5 for organizing and running your unit tests. By the end of this tutorial, you’ll have a solid understanding of the @Tag annotation, its benefits, and how to apply it effectively in your own test cases. Let’s dive in! What is…
Read More @Tag Annotation: Organizing and Running Tests in JUnit 5
If you’re an absolute beginner looking to learn about integration testing for Spring Boot applications with a MySQL database server, then you’re in the right place. As you proceed through this tutorial, remember that everyone was once a beginner, and the only silly question is the one you don’t ask. This tutorial aims to introduce…
Read More Integration Testing with Spring Boot, MySQL and Testcontainers
In this tutorial, you will learn how to deploy a Spring Boot application and a MySQL server in separate Docker containers. By the end of this tutorial, you will know how to run your Spring Boot application in one Docker container and your MySQL server in another Docker container and how to make them communicate…
Read More Deploying a Spring Boot App and MySQL in Docker Containers
Testing is an essential skill for any Java developer. It helps you ensure the quality and reliability of your code, as well as find and fix bugs faster. On this page, you will find a collection of tutorials that will teach you how to test Java code using JUnit 5 and Mockito. JUnit 5 is…
Read More Testing Java Code