Singleton Session Bean in Java EE
1. Overview Whenever a single instance of a Session Bean is required for a given use-case, we can use a Singleton Session Bean. In this tutorial, we’re going to explore the this through an example,...
View ArticleProgrammatic Configuration with Log4j 2
1. Introduction In this tutorial, we’ll take a look at different ways to programmatically configure Apache Log4j 2. 2. Initial Setup To start using Log4j 2, we merely need to include the log4j-core...
View ArticleUsing Lombok’s @Builder Annotation
1. Overview Project Lombok’s @Builder is a useful mechanism for using the Builder pattern without writing boilerplate code. We can apply this annotation to a Class or a method. In this brief tutorial,...
View ArticleIntroduction to Java Microservices with MSF4J
1. Overview In this tutorial, we’ll showcase microservices development using the MSF4J framework. This is a lightweight tool which provides an easy way to build a wide variety of services focused on...
View ArticleNaN in Java
1. Overview Simply put, NaN is a numeric data type value which stands for “not a number”. In this quick tutorial, we’ll explain the NaN value in Java and the various operations that can produce or...
View ArticleJava Weekly, Issue 230
Here we go… 1. Spring and Java >> Java & Docker: Java 10 improvements strengthen the friendship! [aboullaite.me] Java 10 is finally fully suitable for working with Docker >> Metrics...
View ArticleGuide to Java 10
1. Introduction JDK 10, which is an implementation of Java SE 10, was released on March 20, 2018. In this article, we’ll cover and explore the new features and changes introduced in JDK 10. 2. Local...
View ArticleOn Kotlin
Overview >> Introduction to the Kotlin Language Core Concepts >> Comprehensive Guide to Null Safety in Kotlin >> Guide to the “when{}” Block in Kotlin >> Try-with-resources in...
View ArticleGuide to JNI (Java Native Interface)
1. Introduction As we know, one of the main strengths of Java is its portability – meaning that once we write and compile code, the result of this process is platform-independent bytecode. Simply put,...
View ArticleSpring Boot Configuration with Jasypt
1. Introduction Jasypt (Java Simplified Encryption) Spring Boot provides utilities for encrypting property sources in Boot applications. In this article, we’ll discuss how we can add...
View ArticleGetting the Size of an Iterable in Java
1. Overview In this quick tutorial, we’ll learn about the various ways in which we can get the size of an Iterable in Java. 2. Iterable and Iterator Iterable is one of the main interfaces of the...
View ArticleOptional orElse Optional
1. Introduction In some cases, we might want to fallback to another Optional instance if another one is empty. In this tutorial, we’ll briefly mention how we can do that – which is harder than it...
View ArticleUsing the Spring RestTemplate Interceptor
1. Overview In this tutorial, we’re going to learn how to implement a Spring RestTemplate Interceptor. We’ll go through an example in which we’ll create an interceptor that adds a custom header to the...
View ArticleSpring RestTemplate Error Handling
1. Overview In this short tutorial, we’ll discuss how to implement and inject the ResponseErrorHandler interface in a RestTemplate instance – to gracefully handle HTTP errors returned by remote APIs....
View ArticlePessimistic Locking in JPA
1. Overview There are plenty of situations when we want to retrieve data from a database. Sometimes we want to lock it for ourselves for further processing so nobody else can interrupt our actions. We...
View ArticleWorking With Arrays in Thymeleaf
1. Overview In this quick tutorial, we’re going to see how we can use arrays in Thymeleaf. For easy setup, we’re going to use a spring-boot initializer to bootstrap our application. The basics of...
View ArticleContext Hierarchy with the Spring Boot Fluent Builder API
1. Overview It’s possible to create separate contexts and organize them in a hierarchy in Spring Boot. A context hierarchy can be defined in different ways in Spring Boot application. In this article,...
View ArticleDownload a File From an URL in Java
1. Introduction In this tutorial, we’ll see several methods that we can use to download a file. We’ll cover examples ranging from the basic usage of Java IO to the NIO package, and some common...
View ArticleIntroduction to Dagger 2
1. Introduction In this tutorial, we’ll take a look at Dagger 2 – a fast and lightweight dependency injection framework. The framework is available for both Java and Android, but the high-performance...
View ArticleDeploy a Spring Boot App to Azure
1. Introduction Microsoft Azure now features quite solid Java support. In this tutorial, we’ll demonstrate how to make our Spring Boot application work on the Azure platform, step by step. 2. Maven...
View Article