Decode an OkHttp JSON Response
1. Introduction In this article, we’ll see several techniques for decoding a JSON response while using OkHttp. 2. OkHttp Response OkHttp is an HTTP client for Java and Android with features like...
View ArticleSpring Session with MongoDB
1. Overview In this quick tutorial, we’ll be exploring how to use the Spring Session backed with MongoDB, both with and without Spring Boot. Spring Session can also be backed with other stores such as...
View ArticleWorking with XML in Groovy
1. Introduction Groovy provides a substantial number of methods dedicated to traversing and manipulating XML content. In this tutorial, we’ll demonstrate how to add, edit, or delete elements from XML...
View ArticleHibernate Validator Specific Constraints
1. Overview In this tutorial, we’re going to review Hibernate Validator constraints, which are built into Hibernate Validator but are outside the Bean Validation spec. For a recap of Bean Validation,...
View ArticleJava Optional as Return Type
1. Introduction The Optional type was introduced in Java 8. It provides a clear and explicit way to convey the message that there may not be a value, without using null. When getting an Optional...
View ArticleThe Spring Boot Starter Parent
1. Introduction In this tutorial, we’ll learn about spring-boot-starter-parent and how we can benefit from it for better dependency management, default configurations for plugins and quickly build our...
View ArticleIntegrating Groovy into Java Applications
1. Introduction In this tutorial, we’ll explore the latest techniques to integrate Groovy into a Java Application. 2. A Few Words About Groovy The Groovy programming language is a powerful,...
View ArticleCopying Sets in Java
1. Overview A Set is a collection that contains no duplicate elements. In Java, Set is an interface that extends the Collection interface. In this tutorial, we’ll go through different ways of copying...
View ArticleIntroduction to SPF4J
1. Overview Performance testing is an activity often pushed towards the end stages of the software development cycle. We usually rely on Java profilers to help troubleshoot performance issues. In this...
View ArticleBreaking Out of Nested Loops
1. Overview In this tutorial, we’ll create some examples to show different ways to use break within a loop. Next, we’ll also see how to terminate a loop without using break at all. 2. The Problem...
View ArticleJava Weekly, Issue 288
Here we go… 1. Spring and Java >> Hiding Services & Runtime Discovery with Spring Cloud Gateway [spring.io] A solid, ready-to-run example using Spring Cloud’s gateway and registry services....
View ArticleCheck If a String Is a Valid Date in Java
1. Introduction In this tutorial, we’ll discuss the various ways to check if a String contains a valid date in Java. We’ll discuss the solutions before Java 8, after Java 8, and using the Apache...
View ArticleKey Value Store with Chronicle Map
1. Overview In this tutorial, we’re going to see how we can use the Chronicle Map for storing key-value pairs. We’ll also be creating short examples to demonstrate its behavior and usage. 2. What is a...
View ArticleChecking for Empty or Blank Strings in Java
1. Introduction In this tutorial, we’ll go through some ways of checking for empty or blank strings in Java. We’ve got some native language approaches as well as a couple of libraries. 2. Empty vs....
View ArticleChecking If a String Is a Repeated Substring
1. Introduction In this tutorial, we’ll show how we can check in Java if a String is a sequence of repeated substrings. 2. The Problem Before we continue with the implementation, let’s set up some...
View ArticleJava Multi-line String
1. Overview Due to the fact that there is no native multi-line string class in Java yet, it's a little bit tricky to create and utilize multi-line strings. In this tutorial, we walk through several...
View ArticleWhy Choose Spring as Your Java Framework?
1. Overview In this article, we’ll go through the main value proposition of Spring as one of the most popular Java frameworks. More importantly, we’ll try to understand the reasons for Spring being our...
View ArticleSetting the MySQL JDBC Timezone Using Spring Boot Configuration
1. Overview Sometimes, when we’re storing dates in MySQL, we realize that the date from the database is different from our system or JVM. Other times, we just need to run our app with another timezone....
View ArticleA Guide to NanoHTTPD
1. Introduction NanoHTTPD is an open-source, lightweight, web server written in Java. In this tutorial, we’ll create a few REST APIs to explore its features. 2. Project Setup Let’s add the NanoHTTPD...
View ArticleA Guide to Apache Mesos
1. Overview We usually deploy various applications on the same cluster of machines. For example, it’s common nowadays to have a distributed processing engine like Apache Spark or Apache Flink with...
View Article