Calling getClass() From a Static Context
1. Overview In Java, understanding how we call methods in static and non-static contexts is crucial, especially when working with methods like getClass(). One common problem we might encounter is...
View ArticleImplicitly Declared Classes and Instance Main Methods in Java
1. Overview In recent versions of Java, the Oracle team has been focusing on making the Java language more accessible for newbie programmers. As part of that, the Oracle team has introduced implicit...
View ArticleBuilding a RAG App Using MongoDB and Spring AI
1. Overview The use of AI technologies is becoming a key skill in modern development. In this article, we’ll build a RAG Wiki application that can answer questions based on stored documents. We’ll use...
View ArticleIntroduction to the Hilla Framework
1. Overview Hilla is a full-stack web framework for Java. Hilla lets us build a full-stack application by adding React views to a Spring Boot application and calling backend Java services from...
View ArticleLeveraging Quarkus and LangChain4j
1. Overview In this tutorial, we’ll learn about LangChain, a framework for developing applications powered by large language models (LLMs). More specifically, we’ll use langchain4j, a Java framework...
View ArticleIntroduction to TeaVM
1. Overview TeaVM is a powerful tool for translating Java bytecode into JavaScript, enabling Java applications to run directly in the browser. This allows us to maintain a Java-based codebase while...
View ArticleCreate Avro Schema With List of Objects
1. Overview Apache Avro is a data serialization framework that provides powerful data structures and a lightweight, fast, binary data format. In this tutorial, we’ll explore how to create an Avro...
View ArticleJava Weekly, Issue 561
1. Spring and Java >> A beginner’s guide to Spring Data Envers [vladmihalcea.com] Auditing made easy: tracking entity changes with almost no changes required on the application part with Spring...
View ArticleWhat’s the Difference Between interface and @interface in Java?
1. Overview Let’s dive deep to see what interface and @interface are and their applications. An interface is a contract for a class that implements it. In the most common form, it is a group of related...
View ArticleIterate over a Guava Multimap
1. Overview In this article, we will look at one of Map implementations from Google Guava library – Multimap. It is a collection that maps keys to values, similar to java.util.Map, but in which each...
View ArticleGuide to Hibernate’s @TimeZoneStorage Annotation
1. Overview When building our persistence layer with Hibernate and working with timestamp fields, we often need to handle timezone details as well. Since Java 8, the most common approach to represent...
View ArticleWriting JDBC ResultSet to an Excel File Using Apache POI
1. Overview Data handling is one of the critical tasks in software development. A common use case is retrieving data from a database and exporting it into a format for further analysis such as Excel...
View ArticleFormat Output in a Table Format Using System.out
1. Overview In Java applications, it’s often necessary to display data in a table-like format. System.out offers several ways to do this, from simple string concatenation to advanced formatting...
View ArticleHow to Make a Field Optional in JPA Entity?
1. Overview When working with databases and Spring Data, it’s common to encounter scenarios where not all fields in an entity are necessary for every operation. Therefore, we might want to make some...
View ArticleAssert Collection of JSON Objects Ignoring Order
1. Introduction Asserting that collections of JSON objects are equal can be challenging, especially when the order of elements within the collection isn’t guaranteed. While libraries like Jackson and...
View ArticleEfficient Way to Insert a Number Into a Sorted Array of Numbers in Java
1. Overview The usage of arrays is very common in programming languages. Inserting and removing elements from an array of numbers is a basic operation we often need. Inserting an element into a sorted...
View ArticleHow to Handle Alerts and Popups in Selenium
1. Overview In this tutorial, we’ll explore how to handle alerts and popups in Selenium. Alerts and popups are common elements that can interrupt the flow of automated scripts, so managing them...
View ArticleMasking a String Except the Last N Characters
1. Overview In Java, we often need to mask a String, for example to hide sensitive information printed in log files or displayed to the user. In this tutorial, we’ll explore how to accomplish this...
View ArticleHow to Clone a JPA Entity
1. Introduction Cloning a JPA entity means creating a copy of an existing entity. This allows us to make changes to a new entity without affecting the original object. In this tutorial, we’ll explore...
View ArticleHow to Check if Multiplying Two Numbers in Java Will Cause an Overflow
1. Overview In Java, multiplying two numbers can lead to overflow if the result exceeds the limits of the data type (int or long). Java 8 introduced Math.multiplyExact(), automatically detecting...
View Article