Spring MVC, Bootstrap, Thymeleaf, Spring Security - Example

Updated: 2013-08-04

Updated December 08, 2013

In few articles I'll describe how to integrate Spring MVC with Bootstrap, Thymeleaf, Spring Security, Dandelion, JPA, etc.

I started to develop a small framework with the goal to allow developers to start a new web application quickly.

The target features of the framework are:

  • user security
  • user authentication, password reset, …
  • jquery datatables</>
  • document management (upload, …)
  • bootstrap
  • thymeleaf templating
  • extension

The base framework is here: https://github.com/marco76/geniweb (old version based on xml)

The base framework is here: https://github.com/marco76/basicMVC (version based on annotations)

I use this framework for my personal projects and it’s in alpha phase. It’s not intended for production use (yet), but you can use it to see how these technologies integrates together.

On the top of the framework (a jar + some config files) you have the possibility to build your own application.

Here is the example of the result without almost any effort.

framework example

The web application allows some pages to be accessible to anonymous users and other pages to be accessible only to recorded users.

New users have the possibility of ‘signup’ (with or without reCaptcha) …

signup

and receive an email (generated by velocity) to verify the e-mail address

mail

If the user click on the activation his account is created in the database and automatically logged in.

logged

Some features:

  • I added an asyncExecutor to avoid to block the application during the sending of mails
  • The template resolver/engine used is the one of Thymeleaf
  • DataTableDialect allows the use of the library Dandelion (wrapper of JQuery datatables)
  • SpringSecurityDialect allows the integration of SpringSecurity with Thymeleaf
  • CommonsMultipartResolver: used to upload files
  • Embedded database to use the solution out-of-the-box in dev mode
  • Logback logging
  • Tomcat and Jetty (Embedded) support

WebApp built by Marco using Java 21 - Hosted in Switzerland