Posts

Showing posts from May, 2014

Parsing a file with Stream API in Java 8

Streams are everywhere in Java 8. Just look around and for sure you will find them. It also applies to java.io.BufferedReader . Parsing a file in Java 8 with Stream API is extremely easy.

Spice up your test code with custom assertions

Inspired by the @tkaczanowski talk during GeeCON conference I decided to have a closer look at custom assertions with AssertJ library.

HOW-TO: Quartz Scheduler with Clustering in JEE application with MySQL

Image
Quartz Scheduler is one of the most popular scheduling library in Java world. I had worked with Quartz mostly in Spring applications in the past. Recently, I have been investigating scheduling in JEE 6 application running on JBoss 7.1.1 that is going to be deployed in the cloud. As one of the options I consider is Quartz Scheduler as it offers clustering with database. In this article I will show how easy is to configure Quartz in JEE application and run it either on JBoss 7.1.1 or WildFly 8.0.0, use MySQL as job store and utilize CDI to use dependency injection in jobs. All will be done in IntelliJ. Let's get started.

Spring MVC and Thymeleaf: how to acess data from templates

Spring MVC and Thymeleaf: how to acess data from templates I wrote this article for thymeleaf.org, with a great help of Daniel Fernández. You can find it here: http://www.thymeleaf.org/doc/articles/springmvcaccessdata.html ” 12/11/2016: Updated to Thymeleaf 3.0. Find the examples used in this article in this repository: https://github.com/kolorobot/spring-boot-thymeleaf ( http://blog.codeleak.pl/2014/04/how-to-spring-boot-and-thymeleaf-with-maven.html ) In a typical Spring MVC application, @Controller classes are responsible for preparing a model map with data and selecting a view to be rendered. This model map allows for the complete abstraction of the view technology and, in the case of Thymeleaf, it is transformed into a Thymeleaf context object (part of the Thymeleaf template execution context ) that makes all the defined variables available to expressions executed in templates. Spring model attributes Spring MVC calls the pieces of data that can be accessed during