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

Spring DI vs. Dagger 2: Managing Dependencies in Java Microservices

When building Java microservices, dependency injection (DI) is a crucial pattern for managing dependencies and promoting loose coupling between components. Two of the most popular DI frameworks for...

View Article


Java Hibernate OffsetDateTime Mapping

The OffsetDateTime class in Java represents a date-time with a time zone offset from UTC/Greenwich, which can be crucial when working with applications that deal with users in multiple time zones....

View Article


Understanding @BeforeTest and @BeforeMethod in TestNG

In TestNG, annotations like @BeforeTest and @BeforeMethod play a crucial role in setting up the test environment. While they might seem similar, they serve different purposes and are executed at...

View Article

Comparing AWS Lambda and Quarkus for Serverless Java Applications

As serverless computing continues to gain traction, Java developers face a growing need to choose the right framework for building scalable and efficient applications. Two popular options for...

View Article

Pass Object To Modal Dialog In Thymeleaf Example

Thymeleaf is a popular templating engine in the Spring ecosystem. One common requirement is passing data to a modal dialog for display or interaction. Let us delve into understanding how Thymeleaf can...

View Article


Configure @MockBean Components Before Application Start

In modern Spring Boot applications, testing plays a critical role in ensuring the reliability and maintainability of the codebase. A common challenge is how to effectively test components in isolation...

View Article

Spring Batch Run Multiple Jobs Example

Spring Batch is a powerful framework for handling large-volume batch processing. It provides tools for creating robust and scalable batch applications. Let us delve into understanding how to run...

View Article

Fixing “Unable to Find Region” Error in AWS Java SDK

The “Unable to find a region via the region provider chain” error is a common issue when using the AWS SDK for Java. This error occurs when the SDK cannot determine the AWS region for its operations....

View Article


MariaDB4j: Embedded MariaDB Example

MariaDB4j is a Java library that allows developers to run MariaDB in an embedded mode, which is highly useful for testing and development environments. Let’s delve into understanding how to use Java...

View Article


Explaining Advanced JVM Options

1. Introduction The Java Virtual Machine (JVM) is highly customizable via its options. It includes basic configuration through standard options, general performance tuning through non-standard options,...

View Article

How chain.doFilter() Works in a Java Spring Filter

When working with filters in Spring or Java/Jakarta EE, we might encounter the doFilter() method in the Filter interface. This method often includes a call to chain.doFilter(). At first glance, it...

View Article

JUnit vs. Mocha: A Comparison of Java and JavaScript Testing Libraries

Unit testing is a cornerstone of modern software development, ensuring code reliability, catching bugs early, and fostering maintainable applications. When working in Java or JavaScript, JUnit and...

View Article

Transform Future into CompletableFuture

In modern Java programming, handling asynchronous tasks efficiently is a critical skill. Java provides two key abstractions for dealing with asynchronous operations: Future and CompletableFuture. While...

View Article


Spring Boot for Microservices: The Scalable Java Framework

Spring Boot has solidified its place as the go-to framework for building robust and scalable microservices. Its seamless integration with the Java ecosystem and rich feature set make it an essential...

View Article

Moco Stub Server Setup Example

In modern application development, testing APIs and integrating with external services is a critical part of the process. One of the challenges developers face is simulating external systems without...

View Article


How to Count Hills and Valleys in Java Arrays

Pattern recognition in data is a common challenge in computational problems. One such pattern involves identifying “hills” and “valleys” in a sequence of numbers. These patterns appear in many...

View Article

Fix the JsonMappingException – HashMap vs START_ARRAY token

1. Introduction In this example. I will create a simple Java project that demonstrates how to fix the JsonMappingException problem: Can not deserialize instance of java.util.HashMap out of START_ARRAY...

View Article


Log4j vs. Winston: Logging Libraries in Java and JavaScript

Logging is a crucial aspect of application development, enabling developers to monitor, debug, and audit software effectively. Two widely-used logging libraries—Log4j for Java and Winston for...

View Article

Building AI Assistants with Spring AI

Artificial Intelligence (AI) assistants are increasingly becoming an essential part of modern applications. They can enhance user experience by offering conversational interfaces, automating tasks, and...

View Article

Spring Data JPA Query With Arbitrary AND Clauses Example

Building dynamic queries is a common requirement in modern applications, especially when filtering data based on flexible and user-driven criteria. Spring Data JPA provides several mechanisms to...

View Article
Browsing all 745 articles
Browse latest View live