Advent of Code 2018

This year I was introduced to the Advent of Code by Julien and Hielke, who organized a local advent.

It is a great initiative, it is nice to be focused on coding and it adds to a festive atmosphere. Together with four other team members the challenge was accepted. We all took a different approach, as it also stimulates learning a bit about new stuff (e.g. using Kotlin vs Java).

Due to time constraints I have solved only the first half of the advent puzzles, and also by using ‘plain old Java’. But my personal challenge is to look back at the code and apply a better (more modern) alternative in the time to come.

My code can be found at , be warned – it is ‘Hackathon style’ code – as you get more points the faster you finish..

Adding servlet support to the Maven webapp archetype

Today I wanted to create a servlet and used the m2eclipse plugin for Eclipse to create a web application based on the available Maven webapp archetype.

When using the archetype you will miss some essential jars and cannot create a Java 5 servlet. So I did the following:

1. adjust the pom: add dependency


2. adjust the web.xml: adjust the header

<?xml version=”1.0″ encoding=”UTF-8″?> 
<web-app xmlns=”” 
         xmlns:xsi=””        xsi:schemaLocation=”” 

3. open the properties of the project and under Java Compiler change the compliance level to 1.5

Spring Roo

Today I found out about the existence of Spring Roo. A really cool project that certainly fills a sweet spot between what IDE´s and build tools will do for you.

What is Spring Roo: as they say it “a little man that does all stuff you do not want to worry about”.

This translates to CODE GENERATION through a Spring Roo command shell environment.

Example goal: create a wedding RSVP application, including persistence using JPA and Hibernate. Take these steps:

1. create a directory named wedding

2. fire up Roo

3. type “create project” (Roo now creates a Maven 2 project)

4. type “persistence setup –provider HIBERNATE –database HYPERSONIC_PERSISTENT” (this creates all xml and properties files)

5. type the following to fill the database with something:

entity –name ~.domain.Rsvp

field string code –notNull –sizeMin 1 –sizeMax 30

field string email –sizeMax 30

field number attending –type java.lang.Integer

field string specialRequests –sizeMax 100

field date confirmed –type java.util.Date

6. Add a web tier: “controller scaffold ~.web.RsvpController”

7. See what we got! “mvn tomcat:run”

That´s (roughly) it, in just a few steps we have a working web application that conforms to the standards and includes unit tests!

Example taken from the Spring Roo site.