Advise Methods on Annotated Classes With AspectJ
1. Overview In this tutorial, we'll use AspectJ to write trace logging output when calling methods of configured classes. By using an AOP advice to write trace logging output, we encapsulate the logic...
View ArticleJava Weekly, Issue 384
1. Spring and Java >> Why Java's Records Are Better* Than Lombok's @Data and Kotlin's Data Classes [nipafx.dev] More than just boilerplate reductions: a practical take on why Java records are...
View ArticleShould Logging Out Be a GET or POST?
1. Overview In a traditional web application, logging in usually requires sending a username and password to the server for authentication. While these elements could theoretically be URL parameters in...
View ArticleA Guide to Events in OkHTTP
1. Overview Typically when working with HTTP calls in our web applications, we'll want a way to capture some kind of metrics about the requests and responses. Usually, this is to monitor the size and...
View ArticleSpring Boot Cache with Redis
1. Introduction In this short tutorial, we'll look at how to configure Redis as the data store for Spring Boot cache. 2. Dependencies To get started, let's add the spring-boot-starter-cache and...
View ArticleHow to Convert Mono Into Flux
1. Overview Sometimes in Reactive Programming, we could have a publisher of a large collection of items. In some cases, consumers of this publisher might not be able to process all items in one go....
View ArticleUsing Namespaces and Selectors With the Kubernetes Java API
1. Introduction In this tutorial, we'll explore different ways to filter resources using the Kubernetes Java API. In our previous articles covering the Kubernetes Java API, we've focused on the...
View ArticleMapping PostgreSQL Array With Hibernate
1. Overview PostgreSQL supports arrays of any type (built-in or user-defined) to be defined as types of columns of a table. In this tutorial, we'll explore a few ways to map the PostgreSQL array with...
View ArticleFixing the NoSuchMethodError JUnit Error
1. Overview In this article, we're going to learn how to fix the NoSuchMethodError and NoClassDefFoundError JUnit errors. Such problems usually occur when we have two different JUnit versions in our...
View ArticleGetting the Java Version at Runtime
1. Overview Sometimes when programming in Java, it may be helpful to programmatically find the version of Java that we're using. In this tutorial, we'll look at a few ways to get the Java version. 2....
View ArticleUsing an Interface vs. Abstract Class in Java
1. Introduction Abstraction is one of the Object-Oriented programming key features. It allows us to hide the implementation complexities just by providing functionalities via simpler interfaces. In...
View ArticleJava Weekly, Issue 385
1. Spring and Java >> Networking I/O with Virtual Threads – Under the hood [inside.java] Scalability meets a good programming paradigm – taking advantage of non-blocking sockets and continuations...
View ArticleHTTP PUT vs. POST in REST API
1. Overview In this tutorial, we're going to take a quick look at two important HTTP methods – PUT and POST – that are frequently used within the REST architecture. It's no secret that developers...
View ArticleJava Objects.hash() vs Objects.hashCode()
1. Introduction A hashcode is a numeric representation of the contents of an object. In Java, there are a few different methods we can use to get a hashcode for an object: Object.hashCode()...
View ArticleCopying Files With Maven
1. Introduction Maven is a build automation tool that allows Java developers to manage a project's build, reporting, and documentation from a centralized location – the POM (Project Object Model). When...
View ArticleDocker Guide
Docker Basics Setting Memory And CPU Limits In Docker Getting Network Information from Docker Introduction to Docker Compose Difference Between COPY and ADD in a Dockerfile Guide to Docker Volumes...
View ArticleWhen to Use a Parallel Stream in Java
1. Overview Java 8 introduced the Stream API that makes it easy to iterate over collections as streams of data. It's also very easy to create streams that execute in parallel and make use of multiple...
View ArticleReturning an Auto-Generated Id with JPA
1. Introduction In this tutorial, we'll discuss how we can handle auto-generated ids with JPA. There are two key concepts that we must understand before we take a look at a practical example. Those...
View ArticleCode Coverage with SonarQube and JaCoCo
1. Overview SonarQube is an open-source and standalone service that provides an overview of the overall health of our source code by measuring code quality and code coverage. In this tutorial, we'll...
View Article