Convert 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 ArticleRefresh and Fetch an Entity After Save in JPA
1. Introduction Java Persistence API (JPA) acts as a bridge between Java objects and relational databases, allowing us to persist and retrieve data seamlessly. In this tutorial, we’ll explore various...
View ArticleCommit Offsets in Kafka
1. Overview In Kafka, consumers read messages from partitions. While reading messages, there are some concerns to consider, like determining which messages to read from the partitions or, preventing...
View ArticleFind the Largest Number Possible After Removing k Digits of a Number
1. Overview In this tutorial, we’ll see different algorithms allowing us to find the largest number possible after removing the k digits of a number. First, we’ll explain the problem. Then, we’ll see...
View ArticleCalculate Percentiles in Java
1. Overview When it comes to analyzing data in Java, calculating percentiles is a fundamental task in understanding the statistical distribution and characteristics of a numeric dataset. In this...
View ArticleAdding Elements to a Collection During Iteration
1. Introduction Iterating over a List is a common operation in Java, but adding elements to it while iterating requires careful consideration to avoid exceptions and ensure the correctness of the code....
View ArticleRepresentation of Integers at a Bit Level in Java
1. Overview Java stores numbers in memory as binary. Understanding how integers are represented at the bit level can help us with certain operations. In this tutorial, we’ll look at some of the...
View ArticleQuerydsl vs. JPA Criteria
1. Overview Querydsl and JPA Criteria are popular frameworks for constructing type-safe queries in Java. They both provide ways to express queries statically typed, making it easier to write efficient...
View ArticleDynamically Managing Kafka Listeners in Spring Boot
1. Overview In today’s event-driven architectures, managing data streams effectively is essential. Apache Kafka is a popular choice for this, but integrating it into our applications has its...
View Article