Thursday 18 February 2016

Wrex: Primefaces (JSF) + Spring + Hibernate archetype.


I decided to get the structure of wiklimb and make a quick and clean maven project out of it so any one can use it. I called Wrex. Wrex may not be beatiful, but it gets the job done fast.

For those that haven't played the great Mass Effect games Wrex won't mean a thing. But those who had played the know that Wrex is one of the last Krogan Battlemaster, likes to get things done, fast and simple. It's bloody, it's frightening, it's brutal and everyone loves it.

One of the more pain in the ass parts in any project, is to get the environment to work, getting all dependecies and stuff working together. So I have decided to get all the stuff together that I learnt building wiklimb.com in one open archetype for everyone to use.

The main technologies are Primefaces, Spring, and Hibernate (using JPA), with maven to do all the building. All using latest stable versions and working out of the box with just database connection configuration.

Github: https://github.com/konum/wrex 

What does includes?

  • A backend project for the domain and service layers, with all Database related stuff in it.
  • A frontend project for the view and its managedbeans, security, i18n and jetty for runing.
  • A basic model for user login, register and update user info.

The good

  • Facebook login example and register
  • Jetty ready for fast development
  • Forgot password email
  • Cluster markes for Primefaces map
  • Image resize using Clustr library (great open source linrary that uses Java 2D functions for scalign https://github.com/thebuzzmedia/imgscalr)
  • Fileupload ready for PF uploadfile
  • QueryDSL for writing queries in the DAO layer
  • Liquibase for database changes.
  • Use of Maven SQL plugin for cleaning and loading the local database.
  • Integration Junits to the local database.
  • Password encryption
  • Async mail sending
  • Cron jobs using Spring @Scheduled
  • Prettyfaces for permanent URL links and URl rewriting
  • Font awsome icons
  • Ehcache for Hibernate second level cache
  • File service for writing to disk files uploaded by the users.
  • Nice js lightbox library included

The bad

Wrex doesn't use DTOs or VO for moving data arount. Domain objets are used directly in the managed beans of the view. Why? Development speed, less code. Maybe it's not a great aproach for big enterprise scale projects, but after a a bunch of months developing like this for wiklimb I found it perfect for smaller projects. No cumberstone code and model changes are trivial to get to the view.

The Ugly

No pretty default template or pretty layout to start working. Just a basic template with a Mainlayout an ui:composition. Some examples are still missing like the lightbox or the cluster marker for gmaps.

Clone it at Github and have fun:
https://github.com/konum/wrex

No comments:

Post a Comment