Tuesday, 29 January 2013

Anatomy Of The Default OpenShift Spring Web Application

OpenShift lets users create different kind of applications by using cartridges, including Spring applications running on JBoss EAP6. As confirmed by Kazaag on StackOverflow, porting a Spring application developed on Tomcat 7 on JBoss EAP6 should not be a hassle, especially if Tomcat specific features are not used in the application.

The purpose of this post is to discuss the default Spring application offered by OpenShift. On top of typical Spring files, a couple of jboss files are included:
  • jboss-as-spring-mvc-context.xml - This is the equivalent of the servlet-context.xml file in a simple Spring Web MVC application without annotations.
  • jboss-deployment-structure.xml - This file is about solving classloader issues, which is not typical of Spring applications. Thanks to Thomas' answer on StackOverflow, we know this file is not necessary in most cases.
  • spring-quickstart-ds.xml - Registers IronJacamar, JBoss' JCA implementation. One could use Spring's implementation instead.
  • infrastructure.xml - Registers the entity manager factory in JNDI, and enables the JTA transaction management.
Remaining files are typical of Spring MVC applications without annotations.