Quantcast
Channel: Java Archives - Java Code Geeks
Browsing all 743 articles
Browse latest View live

How to Make Multiple REST Calls in CompletableFuture

Parallelism, where multiple tasks are executed simultaneously, can significantly improve performance by reducing the overall wait time for all the tasks to be completed. Let us delve into understanding...

View Article


Hibernate load() and get(): What’s the Difference?

Two commonly used methods in Hibernate for retrieving objects from the database are load() and get(). Though they appear similar, they exhibit distinct differences in behaviour and use cases. This...

View Article


Convert Optional to ArrayList

1. Introduction Java 8 introduced the java.util.Optional class to represent a value that may or may not be present to avoid NullPointerException. Converting an Optional to a java.util.ArrayList can be...

View Article

Finding the Second Smallest Number in an Array in Java

In this article, we will explore three different methods to find the second smallest number in an array using Java. These methods include: Using Array Sorting Using Single Pass Through Using Min Heap...

View Article

Implementing JSON Item Reader and Writer in Spring Batch

Spring Batch is a popular framework for building batch applications in Java. One of the key features of Spring Batch is its ability to read and write data in various formats, including JSON. In this...

View Article


Introduction to JavaParser

JavaParser is a powerful library that provides an easy way to parse, analyze, and manipulate Java source code. It can be used for a variety of purposes, including static code analysis, code generation,...

View Article

Excel File Processing with Spring Batch and JPA

In this article, we will demonstrate how to read all the rows from an Excel (.xls or .xlsx) file using Spring Batch and save them into a database in a Spring Boot application. We will cover the entire...

View Article

A Guide to Micrometer in Quarkus

In this article, we will explore and gain a comprehensive understanding of Micrometers in Quarkus. 1. Introduction Micrometer is a powerful metrics collection library that provides a simple facade over...

View Article


XML File Processing with Spring Batch

Spring Batch provides essential functionalities such as transaction management, job processing statistics, job restart capabilities, and more. One of its key features is the ability to handle large...

View Article


Monads in Java

In the world of programming, managing side effects, handling optional values, and creating robust and maintainable code can be challenging. Monads, a powerful concept from category theory, offer a...

View Article

Introduction to SSHJ

SSHJ is a Java library that simplifies SSH connections, file transfers, and command execution on remote servers. It provides a robust API for secure communication. Let us delve into understanding SSHJ,...

View Article

Embed PostgreSQL in Spring Boot Testing

Testing is a crucial aspect of software development, ensuring that code functions as expected and integrates well with other components. When working with Spring Boot applications that use PostgreSQL...

View Article

Why Java Serialization Might Be a Pain in the JAR

Java serialization, the seemingly simple act of turning objects into bytes for storage or transfer, has earned a reputation for being more trouble than it’s worth. While convenient in theory,...

View Article


Getting Started with Git in IntelliJ IDEA

Git integration in IntelliJ IDEA offers a powerful set of tools for version control, making it easier for developers to manage code changes, collaborate with team members, and maintain a clean project...

View Article

Inject a Mock as a Spring Bean in a Spock Spring Test

Spock is a powerful testing framework for Java and Groovy applications, especially for writing unit and integration tests. It integrates seamlessly with the Spring framework. Let us delve to cover how...

View Article


Secure SPA Authentication with PKCE and Spring Authorization Server

This article will explore implementing authentication in a Single Page Application (SPA) using the Proof Key for Code Exchange (PKCE) extension in the Spring Authorization Server. PKCE is a security...

View Article

A Comprehensive Guide to Optimistic Locking with Java’s StampedLock

In the realm of concurrent programming, ensuring data consistency while maximizing performance is a paramount challenge. Traditional locking mechanisms, while effective, often introduce overhead and...

View Article


Using LangChain4J for Structured JSON Output

LangChain4J is a powerful framework that enables the integration of language models into Java applications. In this article, we will demonstrate how to use LangChain4J in a Spring Boot application to...

View Article

Using Executors.newVirtualThreadPerTaskExecutor() in Java

Java introduced virtual threads with Project Loom to simplify concurrency and improve the scalability of applications. Virtual threads are lightweight and have minimal overhead compared to traditional...

View Article

How to Find the Closest Number to Zero in Java Arrays

This article explores several techniques to efficiently find the closest number to zero in a Java array with positive integers taking priority over negative ones. This problem can arise in various...

View Article
Browsing all 743 articles
Browse latest View live