Java IndexOutOfBoundsException “Source Does Not Fit in Dest”
1. Overview In Java, making a copy of a List can sometimes produce an IndexOutOfBoundsException: “Source does not fit in dest”. In this short tutorial, we're going to look at why we get this error when...
View ArticleLocalizing Exception Messages in Java
1. Overview Exceptions in Java are used to signal that something has gone wrong in a program. In addition to throwing the exception, we can even add a message to provide additional information. In this...
View ArticleIgnoring Fields With the JPA @Transient Annotation
1. Introduction When persisting Java objects into database records using an Object-Relational Mapping (ORM) framework, we often want to ignore certain fields. If the framework is compliant with the...
View ArticleSealed Classes and Interfaces in Java 15
1. Overview The release of Java SE 15 introduces sealed classes (JEP 360) as a preview feature. This feature is about enabling more fine-grained inheritance control in Java. Sealing allows classes and...
View ArticleCreating a Discord Bot with Discord4J + Spring Boot
1. Overview Discord4J is an open-source Java library that can primarily be used to quickly access the Discord Bot API. It heavily integrates with Project Reactor to provide a completely non-blocking...
View ArticleAccessing Spring Boot Logs in Docker
1. Overview In this tutorial, we'll explain how to access Spring Boot logs in Docker, from local development to sustainable multi-container solutions. 2. Basic Console Output To begin with, let's build...
View ArticleSetting Memory And CPU Limits In Docker
1. Overview There are many cases in which we need to limit the usage of resources on the docker host machine. In this tutorial, we'll learn how to set the memory and CPU limit for docker containers. 2....
View ArticleJPA CascadeType.REMOVE vs orphanRemoval
1. Overview In this tutorial, we'll be discussing the difference between two of the options we have for removing entities from our databases when working with JPA. First, we'll start with...
View ArticleJava Weekly, Issue 359
1. Spring and Java >> R2DBC joins Reactive Foundation [r2dbc.io] A good day for open standards: Reactive Relational Database Connectivity (R2DBC) joins the Reactive Foundation! >> The...
View ArticleDispatcherServlet and web.xml in Spring Boot
1. Overview The DispatcherServlet is the front controller in Spring web applications. It's used to create web applications and REST services in Spring MVC. In a traditional Spring web application, this...
View ArticleMaven Packaging Types
1. Overview The packaging type is an important aspect of any Maven project. It specifies the type of artifact the project produces. Generally, a build produces a jar, war, pom, or other executable....
View ArticleDefining Indexes in JPA
1. Introduction In this tutorial, we'll discuss defining indexes using JPA's @Index annotation. Through examples, we'll learn how to define our first index using JPA and Hibernate. After that, we're...
View ArticleTesting Kafka and Spring Boot
1. Overview Apache Kafka is a powerful, distributed, fault-tolerant stream processing system. In a previous tutorial, we learned how to work with Spring and Kafka. In this tutorial, we'll build on the...
View ArticleReusing Docker Layers with Spring Boot
1. Introduction Docker is the de facto standard for creating self-contained applications. From version 2.3.0, Spring Boot includes several enhancements to help us create efficient Docker Images. Thus,...
View ArticleCreating a Generic Array in Java
1. Introduction We may wish to use arrays as part of classes or functions that support generics. Due to the way Java handles generics, this can be difficult. In this tutorial, we'll understand the...
View ArticleExplanation of ClassCastException in Java
1. Overview In this short tutorial, we'll focus on ClassCastException, a common Java exception. ClassCastException is an unchecked exception that signals the code has attempted to cast a reference to a...
View ArticlePerformance Difference Between save() and saveAll() in Spring Data
1. Overview In this quick tutorial, we'll learn about the performance difference between save() and saveAll() methods in Spring Data. 2. Application In order to test the performance, we'll need a...
View ArticleThe Capacity of an ArrayList vs the Size of an Array in Java
1. Overview Java allows us to create arrays of fixed size or use collection classes to do a similar job. In this tutorial, we're going to look at the difference between the capacity of an ArrayList and...
View ArticleJava Weekly, Issue 360
1. Spring and Java >> From Spring Boot to Quarkus [blog.frankel.ch] The new kid on the block: a practical guide on how to migrate a typical Spring Boot app to Quarkus! >> New language...
View ArticleWhat’s New in Java 15
1. Introduction Java 15 reached general availability in September 2020 and is the next short-term release for the JDK platform. It builds on several features from earlier releases and also provides...
View Article