Saturday, May 10, 2008

Presenting the version number on a web front end with spring and maven

This entry will describe how to present a application version number in the pom.xml on a web front end by using spring and maven. Maven generates by default a file in the META-INF folder when generating a war. This file holds the following fields; version, groupId, artifactId
The exact location from your context root is;


by specifying the following bean in your spring config; (REPLACE <groupId> and <artifactId> with what you have defined in your pom.xml)
<bean id="messageSource" class="">
<property name="basenames">

Now the properties in this file can be used in your font-end by using
the standard spring tags for example to print the version number in a
jsp file use the following line;
<b>Version:</b> <spring:message code="version"/>

REMARK don't forget to add the spring tag definition to your jsp file;
<%@ taglib prefix="spring" uri="" %>

No comments: