Building a Data Pipeline with Kafka, Spark Streaming and Cassandra
1. Overview Apache Kafka is a scalable, high performance, low latency platform that allows reading and writing streams of data like a messaging system. We can start with Kafka in Java fairly easily....
View ArticleSpring Boot Ehcache Example
1. Overview Let’s look at an example of using Ehcache with Spring Boot. We’ll use Ehcache version 3 as this provides an implementation of a JSR-107 cache manager. The example is a simple REST service...
View ArticleSumming Numbers with Java Streams
1. Introduction In this quick tutorial, we’ll show various ways of calculating the sum of integers, using the Stream API. For the sake of simplicity, we’ll use integers in our examples. However, we can...
View ArticleRetrieve Fields from a Java Class Using Reflection
1. Overview Reflection is the ability for computer software to inspect its structure at runtime. In Java, we achieve this by using the Java Reflection API. It allows us to inspect the elements of a...
View ArticleJPA 2.2 Support for Java 8 Date/Time Types
1. Overview The JPA 2.2 version has officially introduced the support for Java 8 Date and Time API. Before that, either we had to rely on a proprietary solution, or we had to use the JPA Converter API....
View ArticleCreate a Directory in Java
1. Overview Creating a directory with Java is pretty straight-forward. The language provides us with two methods allowing us to create either a single directory or multiple nested directories – mkdir()...
View ArticleCommon Hibernate Exceptions
1. Introduction In this tutorial, we’ll discuss some common exceptions we can encounter while working with Hibernate. We’ll review their purpose and some common causes. Additionally, we’ll look into...
View ArticleImplementing Simple State Machines with Java Enums
1. Overview In this tutorial, we’ll have a look at State Machines and how they can be implemented in Java using Enums. We’ll also explain the advantages of this implementation compared to using an...
View ArticleCounting Matches on a Stream Filter
1. Overview In this tutorial, we’ll explore the use of the Stream.count() method. Specifically, we’ll see how we can combine the count() method with the filter() method to count the matches of a...
View ArticleVariable Scope in Java
1. Overview In Java, as in any programming language, each variable has a scope. This is the segment of the program where a variable can be used and is valid. In this tutorial, we’ll introduce the...
View ArticleNested forEach in Kotlin
1. Introduction In this short Kotlin tutorial, we’ll look at the parameter scope inside a forEach loop’s lambda. First, we define the data which we’ll use in our examples. Second, we’ll see how to use...
View ArticleGuide to JUnit 5 Parameterized Tests
1. Overview JUnit 5, the next generation of JUnit, facilitates writing developer tests with new and shiny features. One such feature is parameterized tests. This feature enables us to execute a single...
View ArticleFinding Leap Years in Java
1. Overview In this tutorial, we’ll demonstrate several ways to determine if a given year is a leap year in Java. A leap year is a year that is divisible by 4 and 400 without a remainder. Thus, years...
View ArticleDelete the Contents of a File in Java
1. Introduction In this tutorial, we’ll see how we use Java to delete the contents of a file without deleting the file itself. Since there are many simple ways to do it, let’s explore each one by one....
View ArticleConvert a Float to a Byte Array in Java
1. Overview In this quick tutorial, we’ll explore a few examples of using Java to convert a float to a byte array and vice versa. This is simple if we convert an int or a long to a byte array as Java...
View ArticleJava Weekly, Issue 265
Here we go… 1. Spring and Java >> Writing Addons With TestProject [petrikainulainen.net] A solid introduction on how to remove duplicate code from test suites by writing custom TestProject...
View ArticleGuide to XMPP Smack Client
1. Introduction XMPP is a rich and complex instant messaging protocol. Instead of writing our own client from scratch, in this tutorial, we’ll take a look at Smack, a modular and portable open source...
View ArticleConfiguring a DataSource Programmatically in Spring Boot
1. Overview Spring Boot uses an opinionated algorithm to scan for and configure a DataSource. This allows us to easily get a fully-configured DataSource implementation by default. In addition, Spring...
View ArticleBlade – A Complete Guidebook
1. Overview Blade is a tiny Java 8+ MVC framework, built from scratch with some clear goals in mind: to be self-contained, productive, elegant, intuitive, and super fast. Many different frameworks...
View ArticleIntroduction to Clojure
1. Introduction Clojure is a functional programming language that runs entirely on the Java Virtual Machine, in a similar way to Scala and Kotlin. Clojure is considered to be a Lisp derivative and will...
View Article