Checking if a Date Object Equals Yesterday
1. Introduction When working with date and time data in Java applications, it’s often crucial to compare dates for various purposes, such as scheduling tasks, reminders, or reporting. One common...
View ArticleImplement Two-Level Cache With Spring
1. Overview Caching data means our applications don’t have to access a slower storage layer, thereby improving their performance and responsiveness. We can implement caching using any in-memory...
View ArticleCheck if a Given Time Lies Between Two Times Regardless of Date
1. Introduction In Java, there are numerous ways to determine if a particular time lies within the two times without considering dates. In this tutorial, we’ll look at several possible ways to achieve...
View ArticleGuide to ExecutorService vs. CompletableFuture
1. Introduction In this tutorial, we’ll explore two important Java classes for handling tasks that need to run concurrently: ExecutorService and CompletableFuture. We’ll learn their functionalities and...
View ArticleConvert TemporalAccessor to LocalDate
1. Introduction Dealing with date and time values is a common task. Sometimes, we may need to convert a TemporalAccessor object to a LocalDate object to perform date-specific operations. Hence, this...
View ArticleGet a Path to a Resource in a Java JAR File
1. Introduction Resources within a JAR file are typically accessed using a path relative to the root of the JAR file in Java. Furthermore, it’s essential to understand how these paths are structured to...
View ArticleJava Weekly, Issue 536 – Java keeps evolving through JEPs
1. Spring and Java >> Code Before super() – JEP 447 [javaspecialists.eu] A revolution is coming to Java! Soon, you will be able to add custom code before a super() call >> Java users on...
View ArticleInternet Address Resolution SPI in Java
1. Introduction In this tutorial, we’ll discuss Java’s JEP 418, which establishes a new Service Provider Interface (SPI) for Internet host and address resolution. 2. Internet Address Resolution Any...
View ArticleLogging in Apache Camel
1. Overview Logging is essential in software development as it aids in recording every footprint of an application. It helps with tracking the activities and state of an application. Essentially, it’s...
View ArticleMapping Enum With MapStruct
1. Introduction In this tutorial, we’ll learn how to map one enum type to another using MapStruct, mapping enums to built-in Java types such as int and String, and vice versa. 2. Maven Let’s add the...
View ArticleDisable @EnableScheduling on Spring Tests
1. Introduction In this tutorial, we’ll dive into the topic of testing Spring applications which utilize scheduled tasks. Their extensive usage might cause a headache when we try to develop tests,...
View ArticleMultiple-Level Mock Injection Into Mockito Spy Objects
1. Overview In this tutorial, we’ll discuss the well-known Mockito annotations @InjectMock, @Mock, @Spy and understand how they work together in multiple-level injection scenarios. We’ll talk about...
View ArticleImmutable vs Unmodifiable Collection in Java
1. Introduction In this tutorial, we’re looking into two flavors of collections in addition to the common Collection classes we have in Java. As we know, we have three core collection classes: Map,...
View ArticleOpening HTML File Using Java
1. Introduction In various Java applications, HTML files are often needed to be programmatically opened and displayed. Java provides several methods to accomplish this task, whether it’s for generating...
View ArticleStatements Before super() in Java
1. Introduction In Java programming, we use the super() keyword to invoke the superclass constructor. However, there are specific rules regarding the placement of statements before the super() call...
View ArticleDisable @Cacheable in Spring Boot
1. Introduction Caching is an effective strategy to improve performance by avoiding repeated execution of logic when the execution result hasn’t changed (effectively the same) for a known period....
View ArticleQuerying JSONB Columns Using Spring Data JPA
1. Introduction Spring Data JPA provides a powerful abstraction layer for interacting with relational databases. However, traditional relational tables might not be ideal for storing complex,...
View ArticleHow to Check Number Perfection
1. Introduction A perfect number is a special type of positive integer that holds a unique property as it is equal to the sum of its proper divisors, excluding the number itself. One of the most...
View ArticleChecking Which Java Version Is Running in Eclipse
1. Overview When working with Java in the Eclipse IDE, ensuring the correct Java version is essential for compiling and executing code accurately. Eclipse simplifies this process by providing...
View ArticleContinue With Transaction After Exception in JPA
1. Overview The transaction mechanism in JPA is a powerful tool that ensures atomicity and data integrity by either committing all changes or rolling them back in case of an exception. However, there...
View Article