11 Mar 2025
DZone Java Zone
Migrating Java Microservices to Go: A Comprehensive Guide
With the rising demand for high-performance, scalable, and resource-efficient microservices, many organizations are exploring the transition from Java to Go (Golang). Java, a long-standing enterprise favorite, offers robustness and a vast ecosystem, but Go's lightweight concurrency model, fast execution speed, and lower memory footprint make it an attractive alternative.
This guide explores why and how to migrate Java microservices to Go effectively.
11 Mar 2025 6:30pm GMT
8 Java GUI Frameworks for Modern Applications
Java has become one of the world's most versatile programming languages, chosen for its adaptability, stability, and platform independence. Its extensive ecosystem encompasses virtually every application type, from web development to enterprise solutions, game design, Internet of Things (IoT), and beyond.
With an estimated 51 billion active Java virtual machines (JVMs) globally, it goes without question that Java powers a substantial portion of modern software infrastructure.
11 Mar 2025 2:00pm GMT
07 Mar 2025
DZone Java Zone
Floyd's Cycle Algorithm for Fraud Detection in Java Systems
The Floyd Cycle Detection Algorithm (Tortoise and Hare algorithm) is an efficient cycle detection within iterative structures. In addition to linked lists, it is applicable to practical problems such as fraud detection and user workflows where data is duplicated or there are cyclic dependencies in workflows or financial transactions.
This article illustrates its practical implementation with a fraudulent detection system for banking transactions.
07 Mar 2025 11:00pm GMT
How to Use JavaScriptExecutor in Selenium
Selenium is an open-source suite of tools and libraries that allows you to interact with browsers to perform various operations like sending text, clicking on a button, selecting drop-downs, etc.
However, there are scenarios where the actual Selenium WebDriver commands do not work as expected, as Selenium can't interact with the WebElements directly. This is where JavaScriptExecutor comes into the picture.
07 Mar 2025 4:00pm GMT
06 Mar 2025
DZone Java Zone
Enhanced Query Caching Mechanism in Hibernate 6.3.0
Efficient query caching is a critical part of application performance in data-intensive systems. Hibernate has supported query caching through its second-level cache and query cache mechanisms. However, earlier implementations lacked flexibility, and developers had limited control over cache invalidation and customization. Hibernate 6.3.0, released in December 2024, addresses these problems by introducing enhanced query caching mechanisms.
This article talks about the traditional query caching approach in Hibernate and its limitations, along with how the new enhancements in Hibernate 6.3.0 improve the process.
06 Mar 2025 8:15pm GMT
28 Feb 2025
DZone Java Zone
Exploring Embeddings API With Java and Spring AI
Hi community!
This is my second article in a series of introductions to Spring AI. You may find the first one, where I explained how to generate images using Spring AI and OpenAI DALL-E 3 models, here. Today, we will create simple applications using embeddings API and Spring AI.
28 Feb 2025 6:00pm GMT
Thread-Safety Pitfalls in XML Processing
Do you think the method children()
below is thread-safe?
import java.util.stream.Stream;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public final class SafeXml {
private final Node node;
SafeXml(final Node node) {
this.node = node.cloneNode(true);
}
public Stream<SafeXml> children() {
NodeList nodes = this.node.getChildNodes();
int length = nodes.getLength();
return Stream.iterate(0, idx -> idx + 1)
.limit(length)
.map(nodes::item)
.map(SafeXml::new);
}
}
Of course, since I'm asking this question, the answer is no. For those who haven't had the pleasure of working with XML in Java (yes, it's still alive), the org.w3c.dom
package is not thread-safe. There are no guarantees, even for just reading data from an XML document in a multi-threaded environment.
28 Feb 2025 1:00pm GMT
27 Feb 2025
DZone Java Zone
Micronaut vs Spring Boot: A Detailed Comparison
Micronaut and Spring Boot are popular frameworks for developing microservices in Java. They offer robust features for REST API, but their approach towards dependency injection, start-up time, and memory usage differ. This article presents a detailed comparison between both frameworks on various parameters such as implementation, performance metrics, and usefulness of each framework.
The Micronaut Framework Overview
This is a recently developed framework aimed to develop faster microservices and serverless services. Its main feature of compile-time dependency injection results in faster startup times and less memory usage. It has built-in support for cloud environments and serverless deployments and can be integrated with GraalVM. This makes the Micronaut framework suitable for applications where resource utilization is paramount.
27 Feb 2025 5:30pm GMT
Handling Embedded Data in NoSQL With Java
NoSQL databases differ from relational databases by allowing more complex structures without requiring traditional relationships such as one-to-many or one-to-one. Instead, NoSQL databases leverage flexible types, such as arrays or subdocuments, to store related data efficiently within a single document. This flexibility enables developers to design models that suit their application's querying and performance needs.
Jakarta NoSQL is a Java framework that simplifies interactions with NoSQL databases, including MongoDB. It provides annotations that determine how data is mapped and stored, allowing developers to control whether embedded objects are grouped or stored in a flat manner.
27 Feb 2025 4:30pm GMT
24 Feb 2025
DZone Java Zone
How to Quarantine a Malicious File in Java
Scanning file uploads for viruses, malware, and other threats is standard practice in any application that processes files from an external source.
No matter which antimalware we use, the goal is always the same: to prevent malicious executables from reaching a downstream user (directly, via database storage, etc.) or automated workflow that might inadvertently execute the malicious content.
24 Feb 2025 1:00pm GMT
21 Feb 2025
DZone Java Zone
Hexagonal Architecture: A Lyrics App Example Using Java
This architecture principle was created by Alistair Cockburn in 2005. This is one of the many forms of Domain-Driven Design (DDD) Architecture. The goal was to find a way to solve or otherwise mitigate general caveats introduced by object-oriented programming.
This is also known as the Ports and Adapters Architecture. The hexagon concept isn't related to a six-side architecture, nor does it have anything to do with the geometrical form. A hexagon has six sides indeed, but the idea is to illustrate the concept of many ports.
21 Feb 2025 7:30pm GMT
Building a Simple RAG Application With Java and Quarkus
Introduction to RAG and Quarkus
Retrieval-augmented generation (RAG) is a technique that enhances AI-generated responses by retrieving relevant information from a knowledge source. In this tutorial, we'll build a simple RAG-powered application using Java and Quarkus (a Kubernetes-native Java framework). Perfect for Java beginners!
Why Quarkus?
Quarkus provides multiple LangChain4j extensions to simplify AI application development, especially RAG implementation by providing an Easy RAG module for building end-to-end RAG pipelines. Easy RAG acts as a bridge, connecting the retrieval components (like your document source) with the LLM interaction within the LangChain4j framework.
21 Feb 2025 2:30pm GMT
17 Feb 2025
DZone Java Zone
Apache Flink: Full Checkpoint vs Incremental Checkpoint
Apache Flink is a real-time data stream processing engine. Most of the stream processing applications are 'stateful.' This means the state is stored and used for further processing. In Apache Flink, the state is managed through a configured state backend. Flink supports two-state backends in production. One is the HashMapStateBackend
, and the other one is the EmbeddedRocksDBStateBackend
.
To prevent data loss and achieve fault tolerance, Flink can persist snapshots of the state to a durable storage. Flink can be configured to snapshot either the entire state into a durable location or the delta since the last snapshot. The former is called full checkpoint, and the latter is known as the incremental checkpoint.
17 Feb 2025 4:00pm GMT
13 Feb 2025
DZone Java Zone
How Java Servlets Work: The Backbone of Java Web Apps
I assume that if you're reading this article, you already know what Servlets are. But if you don't, let me introduce them.
In the Java world, a Servlet is a web component defined by the Jakarta Servlet Specification 6.1, which is part of Jakarta EE. Managed by a Servlet Container (I'll dive into that soon), it handles incoming requests, processes them, and sends responses back to the client (see more in the Jakarta Servlet Specification 6.1).
13 Feb 2025 7:00pm GMT
A Guide to Constructor Chaining in Java
Constructor chaining refers to the ability to call a constructor inside another constructor. You can use a constructor chain either within the same class or even with another one. For the latter, the constructor must be inherited from the superclass. In this Java programming tutorial, you will learn the three ways to implement constructor chaining.
Java Constructor Chaining in the Same Class
You can create multiple constructors in the same class, each with a different number of arguments that it accepts. To call one constructor within another (of the same class), use this()
.
13 Feb 2025 4:00pm GMT
10 Feb 2025
DZone Java Zone
Spring Data Neo4j: How to Update an Entity
After working on a new online Spring Data Neo4j course, I learned a couple more things about updating an entity. The course required a different set of scenarios than outlined in my previous SDN update blog post, so I wanted to cover those scenarios, as well.
Spring save() Method
First up is the out-of-the-box save()
method that is provided by Spring as a default. This method takes an input of the entity object you want to save to the database.
10 Feb 2025 7:00pm GMT