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

Cracking Java’s Memory Model: Solving OutOfMemoryError in Large Apps

When developing large-scale applications in Java, one of the most common issues developers face is the dreaded OutOfMemoryError (OOM). This error indicates that your application has exhausted its...

View Article


Micronaut Environments Guide

Micronaut is a modern, JVM-based framework that focuses on providing a low memory footprint and fast startup times, making it a great choice for microservices and serverless architectures. One of its...

View Article


Spring MVC Testing: SpringBootTest vs WebMvcTest

When testing RESTful applications in Spring Boot, choosing between @SpringBootTest and @WebMvcTest is essential for efficient testing. These annotations serve different purposes: @SpringBootTest loads...

View Article

Fixing ClassLoader Issues in Java: Dynamic Loading Explained

Java’s ClassLoader mechanism is a powerful feature that allows for the dynamic loading of classes at runtime. This flexibility is essential for many applications, enabling functionality such as plugin...

View Article

Avoiding ClassCastException in Java: Scenarios to Fix Them

Java developers often encounter exceptions, and among the more common ones is ClassCastException. It occurs when an object is cast to a class that it doesn’t belong to. While the error may seem...

View Article


AssertJ Ignore Fields Comparison Example

1. Introduction AssertJ is a fluent assertion library for Java. It’s open-source and supported by the AssertJ team under Apache License 2.0. Its fluent API is designed to make assertions more readable...

View Article

Generate Java Classes From Avro Schemas Using Gradle

In this tutorial, we’ll learn how to generate Java classes from an Apache Avro schema.First, we’ll familiarize ourselves with two methods: using the existing Gradle plugin and implementing a custom...

View Article

How to Avoid Concurrent Modification Exceptions in Java Collections

Java collections are powerful tools for managing data, but they can introduce complexity, especially when dealing with concurrent modifications. One of the most common runtime exceptions developers...

View Article


Make Tests More Readable With Java Spock

Testing is a vital part of modern software development. As we scale our test cases, duplicating code across tests becomes a major concern. Fortunately, Spock provides elegant solutions to help reduce...

View Article


Spring Reactive switchIfEmpty() Example

The switchIfEmpty operator in Spring Reactive allows developers to provide an alternative publisher that is subscribed to when the source publisher completes without emitting any items. Let us delve...

View Article

Multiple Criteria in Spring Data Mongo DB Query

MongoDB, a leading NoSQL database, offers flexibility and scalability, making it a popular choice for modern applications. When working with MongoDB in a Spring environment, Spring Data MongoDB...

View Article

Read and Write in IBM MQ with Java Message Service

IBM MQ is a messaging middleware that facilitates communication between different systems using a queue-based architecture. Java Message Service (JMS) is a common API for accessing message-oriented...

View Article

Checking if a Number is a Palindrome in Java

In coding challenges, checking if a number is a palindrome is a basic and common problem. A palindrome refers to a sequence that reads the same in both directions and while it is often associated with...

View Article


JPA CAST vs TREAT

In JPA (Java Persistence API), managing polymorphic queries involving inheritance hierarchies is a crucial aspect. When working with such queries, developers might need to convert between different...

View Article

Event-Driven Microservices with Spring Boot & Kafka

Event-driven architecture is ideal for microservices because it decouples services, making them more scalable and resilient. Apache Kafka, paired with Spring Boot, provides a solid foundation for...

View Article


JVM Monitoring: Dynamic Attach and Serviceability Agent Overview

The Java Virtual Machine (JVM) includes built-in diagnostics and monitoring tools, like the Dynamic Attach API and the Serviceability Agent (SA), designed to help us manage and troubleshoot running...

View Article

Calling Getclass From a Static Context Example

1. Introduction In Java, the static keyword may be applied to an inner class (a class defined within another class), method, or field (a member variable of a class). A static context and non-static...

View Article


Micronaut Error Handling

Error handling is one of the main concerns when developing systems. On a code level, error handling handles exceptions thrown by the code we write. On a service level, by errors, we mean all the...

View Article

OpenAPI Custom Generator

OpenAPI is a powerful tool for generating code from API specifications, but sometimes, default generators do not meet specific project needs. Let us delve into understanding the creation of a Java...

View Article

Firebase Authentication-Spring Security Integration

Firebase Authentication is a service that allows easy user authentication with email/password, social providers, and phone numbers. On the other hand, Spring Security is a powerful authentication and...

View Article
Browsing all 745 articles
Browse latest View live