30 Jul 2025
DZone Java Zone
Immutable Objects Using Record in Java
It is often useful to have objects that, once created, don't change their content. To see a complete description on how to build such class, you can read my previous article "Immutable Objects in Java".
Let's imagine we want to build a PersonClass
with two fields: firstName
and lastName
. To create immutable instances, this class must:
30 Jul 2025 8:00pm GMT
25 Jul 2025
DZone Java Zone
Smart-Doc: Generating gRPC API Documentation in Java Projects
Foreword
In modern Java microservices, gRPC simplifies inter-service communication with its efficient binary protocol and multi-language support. However, maintaining gRPC API documentation can be challenging as projects grow. Among various AI tools, smart-doc stands out as the optimal solution for generating gRPC API documentation in Java projects.
Advantages of Smart-Doc in Java Projects
1. Fast Speed
Smart-doc is designed to quickly scan code and generate documentation without additional runtime dependencies. It directly extracts .proto
files, compiles them into Java code using protoc
, and then generates documentation by parsing the Java code and comments. This process is much faster than AI tools.
25 Jul 2025 1:00pm GMT
23 Jul 2025
DZone Java Zone
Undocumented Java 16 Feature: The End-of-File Comment
While working on some code where I wanted to obscure parts of it using Unicode escapes instead of the actual source, I accidentally stumbled upon an undocumented feature that's been around since Java 16: what I call the end-of-file comment.
In Java, we typically have three types of comments:
23 Jul 2025 6:00pm GMT
22 Jul 2025
DZone Java Zone
Lock-Free Programming: From Primitives to Working Structures
Working with multiple threads is one of the most complex problems we may encounter in our daily work. When put against the wall of multithreading, most people right away reach out for blocking approaches. In Java, it takes the form of the synchronized keyword, or some other less painful mechanisms, like ReentrantLock. Locks are not the only option: Lock-free programming is also the way.
In this text, I will show problems, techniques, and best practices related to Lock-Free Programming. I will also provide a real-life example of how to implement a Lock-Free stack. Besides, I will share common patterns on moving from Lock-Free to Wait-Free.
22 Jul 2025 11:00am GMT
21 Jul 2025
DZone Java Zone
1-Line IO in Java
Here is a quick coding challenge for all Java developers: How many lines of code do you need to implement the following tasks, using the JDK and any library of your choice?
(Rules of the game: Lines of code are counted using standard formatting, you need to close any opened resources, the code may throw IOExceptions, except if stated otherwise):
21 Jul 2025 12:00pm GMT
17 Jul 2025
DZone Java Zone
How Hackers Exploit Spring Core Vulnerability in 2025: Proactive Measures to Detect Emerging Cyber Threats
API management has emerged as a critical and strategic factor in staying ahead of the market leaders. However, digital transformation has significant disadvantages, such as opening the door to hackers.
Hackers have been quick to take advantage of a serious flaw in Spring Core, commonly known as SpringShell or Spring4Shell among security experts. The cybercriminal sends a specially created query to the Spring Core framework's web application server.
17 Jul 2025 7:00pm GMT
Fraud Detection in Mobility Services With Apache Kafka and Flink
Mobility services like Uber, Grab, FREE NOW (Lyft), and DoorDash are built on real-time data. Every trip, delivery, and payment relies on accurate, instant decision-making. But as these services scale, they become prime targets for sophisticated fraud-GPS spoofing, fake accounts, payment abuse, and more. Traditional, batch-based fraud detection can't keep up. It reacts too late, misses complex patterns, and creates blind spots that fraudsters exploit. To stop fraud before it happens, mobility platforms need data streaming technologies like Apache Kafka and Apache Flink for fraud detection. This blog explores how leading platforms are using real-time event processing to detect and block fraud as it happens-protecting revenue, user trust, and platform integrity at scale.
The Business of Mobility Services (Ride-Hailing, Food Delivery, Taxi Aggregators, Etc.)
Mobility services have become an essential part of modern urban life. They offer convenience and efficiency through ride-hailing, food delivery, car-sharing, e-scooters, taxi aggregators, and micro-mobility options. Companies such as Uber, Lyft, FREE NOW (former MyTaxi; acquired by Lyft recently), Grab, Careem, and DoorDash connect millions of passengers, drivers, restaurants, retailers, and logistics partners to enable seamless transactions through digital platforms.
17 Jul 2025 12:00pm GMT
15 Jul 2025
DZone Java Zone
How to Build a Real API Gateway With Spring Cloud Gateway and Eureka
API gateways are essential in a microservices architecture.
But building one that's real-world-ready, secure, scalable, and service-aware will require more than just wiring a few annotations.
15 Jul 2025 3:00pm GMT
Memory Leak Due To Mutable Keys in Java Collections
Java Collections components (such as Map, List, Set) are widely used in our applications. When their keys are not properly handled, it will result in a memory leak. In this post, let's discuss how incorrectly handled HashMap key results in OutOfMemoryError. We will also discuss how to diagnose such problems effectively and fix them.
HashMap Memory Leak
Below is a sample program that simulates a memory leak in a HashMap due to a mutated key:
15 Jul 2025 11:00am GMT
11 Jul 2025
DZone Java Zone
When MySQL, PostgreSQL, and Oracle Argue: Doris JDBC Catalog Acts as the Peacemaker
At noon, Xiao Wang was staring at his computer screen, looking worried.
He is in charge of the company's data platform and recently received a task: to perform real-time analysis on data from three different databases-MySQL, PostgreSQL, and Oracle.
11 Jul 2025 4:00pm GMT
Secret Recipe of the Template Method: Po Learns the Art of Structured Cooking
A grand gala was being held at the Jade Palace. The Furious Five were preparing, and Po was helping his father, Mr. Ping, in the kitchen. But as always, Po had questions.
Po (curious): "Dad, how do you always make the perfect noodle soup no matter what the ingredients are?"
11 Jul 2025 3:00pm GMT
09 Jul 2025
DZone Java Zone
Testing Java Applications With WireMock and Spring Boot
Your application has an integration with another system. In your unit integration tests, you want to mock the other system's behaviour. WireMock is a testing library that helps you with mocking the APIs you depend on. In this blog, you will explore WireMock for testing a Spring Boot application. Enjoy!
Introduction
Almost every application has an integration with another system. This integration needs to be tested, of course. Testcontainers are a good choice for writing unit integration tests. This way, your application will talk to a real system in your tests.
09 Jul 2025 4:00pm GMT
04 Jul 2025
DZone Java Zone
Modernizing Apache Spark Applications With GenAI: Migrating From Java to Scala
If you're working on big data projects using Spark, you've likely come across discussions within your team about Java vs. Scala vs. Python, along with comparisons in terms of implementation, API support, and feasibility. These technologies are typically chosen on a case-by-case basis depending on the specific use case.
For example, data engineering teams often prefer to use Scala over Java because of:
04 Jul 2025 7:00pm GMT
01 Jul 2025
DZone Java Zone
A Keycloak Example: Building My First MCP Server Tools With Quarkus
Recently, I explored how the Model Context Protocol (MCP) is gaining traction in the Java ecosystem, with frameworks like Spring AI, Quarkus, and LangChain4j starting to adopt it for integrating language models via standardized interfaces. It was also time to start experimenting with writing an MCP Server myself (well maybe not the first time). Certainly, I don't want to be left out of all the cool things being demonstrated by the community. The goal for me is to learn, and creating perhaps a more practical example.
In this post I am going to choose Keycloak, and write an experimental MCP server implementation for Keycloak. The post is also to spark interest around this topic: Will it be useful to have an MCP server for Keycloak?
01 Jul 2025 7:00pm GMT
Spring Cloud LoadBalancer vs Netflix Ribbon
The Spring Cloud ecosystem has been evolving significantly over the years. At first, it was mainly based on the Netflix stack, then it started shifting towards its own solutions. One of the components that has been substituted is Netflix Ribbon. Ribbon is a client-side load balancer and has been replaced by Spring Cloud LoadBalancer.
Spring Cloud LoadBalancer is a more modern and maintainable solution. In this article, you will learn the differences between the two, their designs, and practical examples in Java.
01 Jul 2025 6:00pm GMT
Squid Game: The Clean Code Trials — A Java Developer's Survival Story
"In the world of code, there are only two outcomes: evolve or perish."
Episode 1: The Red Light of Rigid Code
Scene: A vast ODC filled with desks, whiteboards, and terminals. The chairs are marked with red and green stickers. Software contestants sitting, trembling, gazing at a giant robot doll that watches them intently.
01 Jul 2025 4:00pm GMT