In this guide, I’ll show you how to create a Fat Jar with Spring Boot. Together, we’ll build a simple ‘UsersMicroservice’, then pack it into a Fat Jar. Don’t worry if you’re new, I’ll guide you step-by-step and answer your top questions along the way. Let’s get started! What is a Fat JAR? A Fat…
Read More Creating a Fat Jar App with Spring Boot
@Component is a Spring annotation that is used to indicate that a class is a component. Components are objects that make up the structure of an application and are responsible for performing specific tasks. They are typically used to represent services, controllers, repositories, and other types of objects that are used to implement business logic…
Read More @Component Annotation in Spring
In this tutorial, you will learn how to setup Eureka Cluster on your local computer. Although in this tutorial, I am going to setup Eureka Cluster on my local computer, you will still learn what you need to do to make Eureka run on remote server as well. What is Eureka Server Cluster? A Eureka…
Read More Eureka Server Cluster Setup Tutorial
When working with Java programming, it is often essential to determine whether a given string represents a numeric value. This task is crucial for a variety of scenarios, such as validating user input, performing calculations, or processing data. By accurately identifying numeric strings, you can ensure the correctness and integrity of your application’s logic. The…
Read More Java: Check if String is Numeric
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
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
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
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?
IMPORTANT: This information is no longer actual. Apparently it was just a bug in Spring Initializr tool and Eureka is available with Spring Boot version 3.1.0 just fine. If you’re using Spring Initializr tool for creating Spring Boot projects, you might have noticed a change. In Spring Boot version 3.1.0, the tool no longer allows…
Read More Eureka Discovery with Spring Boot 3.1.+
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
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
Mocking a static or private method is often necessary when writing unit tests. However, before Mockito 3.4.0, it was impossible to explicitly mock static methods. Thus, PowerMock offers solutions to the defined use case. In this article, we will look at the introduction of PowerMock and explore examples of mocking private, static, and final methods.…
Read More A Guide to Mocking Private and Static Methods Using PowerMock