Friday, 7 September 2018

Garrus: A Java Spring Rest + Angular 6 ready-to-code scaffold.

It's been a while since I wrote in this blog. My lasts years of work have been more on the managament and team leadership side of software development. But it's time to get hands on code again.

As I want to start to develop apps for local clients and for my own, I needed to update my stack. Primefaces is great, but I wanted to learn Node long ago, so I decided to start with Angular for the frontend. I stuck with Java for the backend for two main reasons: experience and mature frameworks.

After a couple weeks of work I created Garrus, a full stack scaffold, fully funciontal with a couple of CRUDs for example. Just 4 commands are neccesary to get it running.

Stack and details


  • Spring Boot for running and packing.
  • Spring Data for data access + Hibernate 5.
  • Spring security with JWT (Json web tokens) for the rest services. Includes examples on how to secure the acces to the resources with @PreAuthorize
  • Junit with Spring boot.
  • MapStruct (a cool mapping tool without using reflection) for mappin data entities and DTOs at rest layer.
  • Different maven profiles preconfigured.
  • User table for login. Password stored as plain text.
  • Vehicles and drivers simple model for reference and example.


How to get it running

All steps are in the github of the project. If you have any doubt just let me know!

Tuesday, 22 May 2018

Wrex Update: Primefaces 6 + Spring + Spring Data

After a couple of years with out publishing anything or touching my projects, I once again installed eclipse in my home laptop and started to wonder, what can I do? Without an interesting idea to develop I thought it would be good to refresh Wrex, my quick'n dirty archetype for java applications.

The original idea of Wrex is to avoid the hassle of setting an environment for develop low scale web application or play around with the frameworks. Just a set the connection to the database and in two maven commands you get yourself a 3 tier webapp with spring, primefaces, user login, register, email sending, among other goodies. Neat and quick.

Whats new?

MySQL 8: New hard drive means new installations, so the latest version of MySQL was an obvious choice. Updated dependencies and configurations for this version.

Spring Data: Got rid of those old fashioned DAOs and added Spring Data to the backend. Spring Data is a greet tool to access your data without having to write and implementation.

DTOs: Using database entities in the front layer is really quick, but ugly as hell and can lead to serious problems with persistence. I added a wrex-api project that isolates the backend with the frontend.

MapStruct: While isolation with layers is a good thing, it adds the necessity to map between the persistence classes and the DTOs. Using MapStruct that mapping is done in compile time and you just have to create and interface. No reflection is used in runtime. Dozer, a mapping tool that uses reflection, spent 370ms mapping 10.000 simple object StructMap did the same in 7ms.

Logback: Logging is now done with logback.

Primefaces 6: Updated to PF6.2.

 POM order: I cleaned the poms a little bit.

And that's everything. It didn't take long and now Wrex looks a little more professional without loosing is founding principle.

You can get wrex at

Next project is Garrus an Angular JS front end with a Spring Boot backend. Stay tuned!