7.3. Migrating Spring PetClinic Example
This section explains the migration of Spring PetClinic sample application. Download the application from Spring Framework's github repository at https://github.com/spring-projects/spring-petclinic.
The example provides a number of alternative data access implementations, to use these implementations change the
web.xml file. This shows the migration strategies in each case, noting that only one of these strategies is used at a time.
To help you with the migration process, a migrated example named
spring-petclinic is distributed with this release of JBoss Web Framework Kit. It can be obtained from the JBoss Web Framework Kit quickstarts.zip file which is available to download from the Red Hat Customer Portal at https://access.redhat.com/ or from the JBoss Developer website at http://www.jboss.org/.
7.3.1. Preliminary Changes in Spring PetClinic Example
Before starting the actual migration process, make a few adjustments to the
pom.xml file. Spring Petclinic uses Hibernate 4.3.8.Final, which is not supported on Red Hat JBoss Enterprise Application Platform 6.x. So, downgrade the version of Hibernate to a supported version. Change Hibernate version in the pom.xml file to 4.2.14.SP4-redhat-1.
Note
You can also use a BOM to reference the supported versions of Hibernate. There is a Hibernate BOM org.jboss.bom.eap:jboss-javaee-6.0-with-hibernate.
7.3.2. Build and Deploy the Spring PetClinic Application
Execute the following steps to build and deploy the Spring Petclinic application downloaded from the github repository:
- Run an instance of JBoss Enterprise Application Platform.
$EAP_HOME/bin/standalone.sh
- Navigate to the root directory of the Spring Petclinic application.
cd $spring-petclinic
- Build and deploy the application using Maven.
mvn clean package
- Copy
petclinic.warfile into the JBoss Enterprise Application Platform instance.cp petclinic-spring/target/petclinic.war $EAP_HOME/standalone/deployments/
After the example has been deployed, you can access it at http://localhost:8080/petclinic/.