About Me

Hi, my name is Wim Deblauwe, a software developer specialized in Java, Spring, and JVM related tooling.

I wrote Taming Thymeleaf, a book to learn more about using Thymeleaf with Spring Boot. I also have a few open-source projects: one that makes it easy to do Spring Boot error handling, another for integration of Cypress with Testcontainers and a few others.

I blog regularly here about Spring Boot, Thymeleaf,Asciidoctor and other programming related subjects.

Stay up to date with the latest content via the RSS feed, follow me on Twitter, or subscribe to the mailing list.

Recent posts

Jan 22, 2017

AssertJ custom assertion for ConstraintValidator tests

As a follow-up to my last post on a custom validator to check if a String contains XML, I like to elaborate on how I made the unit test so readable. To repeat, here is part of the unit test again with the assertions highlighted: @Test public void givenNoXml_notValid() { ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); TestObject testObject = new TestObject("This is no XML string"); Set<ConstraintViolation<TestObject>> violationSet = validator.

Read More...

Jan 21, 2017

Custom Validator to check if a String contains XML

This blog post will show you how to create a custom validator to check if a String contains valid XML using the Java Validation API. Suppose you have a highly technical application that requires the user to enter some XML in a web form. You want to validate this on the client side, but also on the server side, since you should never trust your client. For the purpose of the example, suppose you have this entity:

Read More...

May 5, 2016

Angular datatables with server side pagination using Spring Data

We are using angular-datatables in a project. So far, we just returned all entities from the server’s REST controller (Using Spring Boot and Spring Data on the server side). I wanted to see how I could implement server side pagination to avoid returning all records at once. I was lucky to find spring-data-jpa-datatables which makes it very easy to do. First, add the dependency in your pom.xml: <dependency> <groupId>com.github.darrachequesne</groupId> <artifactId>spring-data-jpa-datatables</artifactId> <version>2.

Read More...

Apr 1, 2016

AssertJ custom assertion for testing ConstraintValidator implementations

If you want to unit test a ConstraintValidator with AssertJ, then you can use this custom validator to make the tests more readable: import org.assertj.core.api.AbstractAssert; import javax.validation.ConstraintViolation; import java.util.Set; import java.util.stream.Collectors; public class ConstraintViolationSetAssert extends AbstractAssert<ConstraintViolationSetAssert, Set<? extends ConstraintViolation>> { public ConstraintViolationSetAssert(Set<? extends ConstraintViolation> actual) { super(actual, ConstraintViolationSetAssert.class); } public static ConstraintViolationSetAssert assertThat(Set<? extends ConstraintViolation> actual) { return new ConstraintViolationSetAssert(actual); } public ConstraintViolationSetAssert hasViolationOnPath(String path) { isNotNull(); // check condition if (!

Read More...

Sep 30, 2015

Read only EntryProcessors with Hazelcast

This post is a follow-up on my post EntryProcessors and EntryBackupProcessors with Hazelcast. In the comments, Peter Veentjer from Hazelcast gave me the idea to use an EntryProcessor to read part of the data. I will show you below how to best do this. We start with a cache that has 10 User objects in it and we want to retrieve the user names of all users in the cache.

Read More...

Sep 29, 2015

EntryProcessors and EntryBackupProcessors with Hazelcast

Hazelcast has the concept of EntryProcessors (like Oracle Coherence). EntryProcessors allow to update cache entries without having to pull over the actual values. You move the processing to where the value lives and update the cache there. Furthermore, Hazelcast has the notion of EntryBackupProcessor (which Coherence does not have). To explain the usage of this, we will use a simple User class: class User implements Serializable { private long id; private String name; private DateTime lastLoginTime; // getters and setters omitted } We will set the 'lastLoginTime' on the user by means of an EntryProcessor.

Read More...

Mar 24, 2015

Introduction to using JavaFX with afterburner.fx

I wanted to try out afterburner.fx, a JavaFX framework which describes itself as: a minimalistic (3 classes) JavaFX MVP framework based on Convention over Configuration and Dependency Injection. For this purpose I created a simple note taking application which looks like this when finished: First off, the domain class that represents a Note: public class Note { private long id; private String title; private String content; // Getter and setters ommitted I also made a NoteService to retrieve the current notes and update an existing note:

Read More...

Mar 13, 2015

Using Font Awesome in JavaFX with fontawesomefx

Icons are a great way to spice up any UI. You can easily use the Font Awesome icons in JavaFX, by using the fontawesomefx library. I will show a small example on how to use the icons in JavaFX code and how to apply some styling. First import the library. I am using Maven, so I just add this dependency: <dependency> <groupId>de.jensd</groupId> <artifactId>fontawesomefx</artifactId> <version>8.2</version> </dependency> We will start with a simple app that uses a BorderPane to put some content at the center and have a kind of header at the top:

Read More...

Nov 4, 2014

Spring Boot application with exploded directory structure

Spring Boot is really amazing for getting started quickly with a new Spring application. By default, your application is contained in a single jar when packaging it. This has some advantages, but what if you want a "classic" layout with a config folder (for your application.properties or logback.xml files) and a lib folder? Getting Started This blog post will show you a way of doing this using Maven and the Maven Assembly Plugin.

Read More...

Jul 16, 2014

Opening multiple SSH sessions with iTerm automatically

iTerm is great, but if you are working with a cluster of servers, it quickly becomes tedious to open an SSH session to each server and to configure splits so you can talk to all servers at once. Based upon the scripts here (but does not use splits) and here (but does not work with 7 servers which I needed in my case), I came up with the following AppleScript that works for me.

Read More...