Configuring Separate Spring DataSource for Tests
1. Overview When testing a Spring application that relies on a persistence layer, such as JPA, we may want to set up a test data source to use a smaller, faster database – one that is different from...
View ArticleQuick Guide to the Java StringTokenizer
1. Overview In this quick article, we’ll explore a fundamental class in Java – the StringTokenizer. 2. StringTokenizer The StringTokenizer class helps us split Strings into multiple tokens....
View ArticleTesting a REST API with JBehave
1. Introduction In this article, we’ll have a quick look at JBehave, then focus on testing a REST API from a BDD perspective. 2. JBehave and BDD JBehave is a Behaviour Driven Development framework. It...
View ArticleAvoiding ConcurrentModificationException when Iterating and Removing
1. Introduction When it comes to iterating and modifying collections, ConcurrentModificationException is a common scenario to be thought about. This exception gets thrown by collection iterators in a...
View ArticleREST Query Language – Implementing OR Operation
1. Overview In this quick article, we’ll extend the advanced search operations that we implemented in the previous article and include OR-based search criteria into our REST API Query Language. 2....
View ArticleWorking with an Embedded Jetty Server in Java
1. Overview In this article, we will be looking at the Jetty library. Jetty provides a web server that can run as an embedded container and integrates easily with the javax.servlet library. 2. Maven...
View ArticleIntroduction to Jenetics Library
1. Introduction The aim of this series is to explain the idea of genetic algorithms and show the most known implementations. In this tutorial, we’ll describe a very powerful Jenetics Java library that...
View ArticleJava Web Weekly, Issue 172
Lots of interesting writeups on Java 9 this week. Here we go… 1. Spring and Java >> Accessing private state of Java 9 modules [in.relation.to] The introduction of modularity to Java 9 sheds new...
View ArticleUsing @JsonComponent in Spring Boot
1. Overview This quick article is focused on how to use the @JsonComponent annotation in Spring Boot. The annotation allows us to expose an annotated class to be a Jackson serializer and/or...
View ArticleDynamic DTO Validation Config Retrieved from DB
1. Overview In this tutorial, we’re going to take a look at how we can create a custom validation annotation that uses a regular expression retrieved from a database to match against the field value....
View ArticleConverters, Listeners and Validators in Java EE 7
1. Overview Java Enterprise Edition (JEE) 7 provides some useful features e.g. for validating user input, converting values into appropriate Java data types. In this tutorial, we’ll focus on those...
View ArticleJava Flow Control Interview Questions (+ Answers)
1. Introduction Control flow statements allow developers to use decision making, looping and branching to conditionally change the flow of execution of particular blocks of code. In this article,...
View ArticleAn Introduction to ThreadLocal in Java
1. Overview In this article, we will be looking at the ThreadLocal construct from the java.lang package. This gives us the ability to store data individually for the current thread – and simply wrap...
View ArticleJVM Log Forging
1. Overview In this quick article, we’ll explore one of the most common security issues in JVM world – Log Forging. We’ll also show an example technique that can protect us from this security concern....
View ArticleIntroduction to Apache Flink with Java
1. Overview Apache Flink is a Big Data processing framework that allows programmers to process the vast amount of data in a very efficient and scalable manner. In this article, we’ll introduce some of...
View ArticleJava Exceptions Interview Questions (+ Answers)
1. Overview Exceptions are an essential topic that every Java developer should be familiar with. This article provides answers to some of the questions that might pop up during an interview. 2....
View ArticleGuide to sun.misc.Unsafe
1. Overview In this article, we’ll have a look at a very interesting class provided by the JDK – Unsafe from the sun.misc package. This class provides us with low-level mechanisms that were designed...
View ArticleJVM Garbage Collectors
1. Overview In this quick tutorial, we will show the basics of different JVM Garbage Collection (GC) implementations. Additionally, we’ll find out how to enable a particular type of Garbage Collection...
View ArticleA Guide to MyBatis
1. Introduction MyBatis is an open source persistence framework which simplifies the implementation of database access in Java applications. It provides the support for custom SQL, stored procedures...
View ArticleCreating a Custom Starter with Spring Boot
1. Overview The core Spring Boot developers provide starters for most of the popular open source projects, but we are not limited to these. We can also write our own custom starters. If we have an...
View Article