Injecting a Value in a Static Field in Spring
1. Overview In this tutorial, we'll see how we can inject a value from a Java properties file to a static field with Spring. 2. Problem To begin with, let's imagine that we set a property to a...
View ArticleCould Not Reserve Enough Space For Object Heap
1. Overview In this tutorial, we'll learn the cause of “Could not reserve enough space for object heap” error, while going through some possible scenarios. 2. Symptoms “Could not reserve enough space...
View ArticleHow to Use Regular Expressions to Replace Tokens in Strings
1. Overview When we need to find or replace values in a string in Java, we usually use regular expressions. These allow us to determine if some or all of a string matches a pattern. We might easily...
View ArticleGetting Into a Docker Container’s Shell
1. Overview We know Docker is a powerful tool for creating, deploying, and running applications easily. In the images vs containers tutorial, we discussed how Docker images are built using layers. We...
View ArticleUsing NullAway to Avoid NullPointerExceptions
1. Overview We've been undertaking numerous strategies over the years, from Elvis operators to Optional, to help remove NullPointerExceptions from our apps. In this tutorial, we'll learn about Uber's...
View ArticleDelete Everything in Redis
1. Overview When caching in Redis, it can be useful to clear the whole cache when it becomes invalid. In this short tutorial, we'll learn how to delete all the keys present in Redis, both in specific...
View ArticleJava Weekly, Issue 324
1. Spring and Java >> Getting Started With RSocket: Spring Boot Client [spring.io] A quick tutorial that uses Spring Shell to build and run a simple RSocket client for sending request-response...
View ArticlePassing Environment Variables to Docker Containers
1. Overview It is often a good idea to separate our services from their configuration. For a twelve-factor app, we should store configuration in the environment. Of course, this means we'll need a way...
View ArticleGuide To The Java Authentication And Authorization Service (JAAS)
1. Overview Java Authentication And Authorization Service (JAAS) is a Java SE low-level security framework that augments the security model from code-based security to user-based security. We can use...
View ArticleOptical Character Recognition with Tesseract
1. Overview With the advancement of technology in AI and machine learning, we require tools to recognize text within images. In this tutorial, we'll explore Tesseract, an optical character recognition...
View ArticleCompare Two JSON Objects with Gson
1. Overview JSON is a string representation of data. We may wish to compare this data in our algorithms or tests. And though it's possible to compare strings containing JSON, string comparison is...
View ArticleIntelliJ – Cannot Resolve Spring Boot Configuration Properties Error
1. Overview When we're injecting runtime properties into our Spring applications, we may define bean classes for groups of custom properties. IntelliJ provides help and auto-complete for the built-in...
View ArticleL-Trim and R-Trim Alternatives in Java
1. Overview The method String.trim() removes trailing and leading whitespace. But, there's no support for just doing an L-Trim or R-Trim. In this tutorial, we'll see a few ways that we can implement...
View ArticleKeycloak Embedded in a Spring Boot Application
1. Overview Keycloak is an open-source Identity and Access Management solution administered by RedHat, and developed in Java by JBoss. In this tutorial, we'll learn how to set up a Keycloak server...
View ArticleDifference Between Thread and Virtual Thread in Java
1. Introduction In this tutorial, we'll show the difference between traditional threads in Java and the virtual threads introduced in Project Loom. Next, we'll share several use cases for virtual...
View ArticleIntroduction to Alibaba Arthas
1. Introduction Alibaba Arthas is a diagnostic tool that enables us to monitor, profile, and troubleshoot our Java applications. One of the key benefits of using Arthas is that we don't need to change...
View ArticleJava IO vs NIO
1. Overview Handling input and output are common tasks for Java programmers. In this tutorial, we'll look at the original java.io (IO) libraries and the newer java.nio (NIO) libraries and how they...
View ArticleQuick Guide to Hibernate enable_lazy_load_no_trans Property
1. Overview While using lazy loading in Hibernate, we might face exceptions, saying there is no session. In this tutorial, we'll discuss how to solve these lazy loading issues. To do this, we'll use...
View ArticleExploring a Docker Container’s Filesystem
1. Overview When we work with Docker, sometimes we need to check configuration or log files inside a container. In this quick tutorial, we'll see how to inspect the filesystem of a Docker container to...
View ArticleJava Weekly, Issue 325
1. Spring and Java >> Spring Tips: Java 14 (or: Can Your Java Do This?) [spring.io] A few practical examples showing how to get the most out of Java 14 in a Spring Boot app. >> GraalVM...
View Article