Showing posts from 2014

Externalising Spring Configuration

Enterprise applications typically contain a number of  properties and  runtime resources that must be configured before the application is deployed. Property and resource values can either be baked into the artefact at build time using something like Maven Profiles or derived at runtime using Spring Profiles. My preferred approach is to externalise all configuration so that the artefact taken from the build server is environment agnostic and can be deployed onto any environment . For example, we could take a WAR file from our build server and  deploy it to our development, UAT or production environments without changing any configuration in the WAR file itself.

Spring Property Configuration Spring applications use the PropertyPlaceholderConfigurer to load application properties. Property files are typically loaded from the class path but the example below uses a slightly different approach, loading the properties file from a directory outside of the application itself. This allows the…

Spring Batch Tutorial

Introduction Spring batch is a lightweight framework that provides a solid foundation on which to build robust and scalable batch applications. It provides developers with a set of tried and tested patterns that solve common batch problems and allows developers to focus more on the business requirement and less on complex batch infrastructure. Spring batch contains a variety of out of the box configurable components that can be used to satisfy many of the most common batch use cases. Extensive XML configuration and an extensible programming model mean that these components can be customised and used as building blocks to quickly deliver common batch functionality.
This tutorial will show you how to build a very simple batch application to read fixed length data from a flat file and write it to a database table. This is a common batch use case and should be sufficient to demonstrate some of the fundamental concepts of Spring batch and provide you with a foundation on which to build mor…

Web Resource Optimisation with WRO4J

Its been a while since I've posted anything so I'm going to ease myself back in with a post on web resource optimisation, and in particular my recent experience optimising a Java web application using WRO4J.

What is Web Resource Optimisation? Rich internet applications are now common place, delivering a slick, responsive user experience that in the past was only possible with thick client applications. Modern web applications are typically composed of many JavaScript and CSS resources, so we need to consider ways of optimising how theses resources are served to the client. The objective of web resource optimisation like any other type of optimisation, is to increase application performance and ultimately improve user experience.

In this post I'll create a very simple Spring MVC app with 2 JSP views that import some CSS and JavaScript resources. Both views will import the same resources, the difference being that one will manage resources using a traditional approach, while …