Skip to content

13. Version 8: Porting the application to a Spring/Tomcat environment


Question: Following the example "Sample Application – 02: rdvmedecins-jsf2-spring" from [ref3], port the previous application to a Spring/Tomcat/Hibernate environment.


  

The new web application is [mv-pam-jsf2-spring-multipages]. The web interface remains unchanged:

Image

Here is one possible approach:

  1. create a Maven project of type [Java Application] named [mv-pam-spring-metier],
  2. add the necessary dependencies,
  3. copy the elements from the previous EJB project into the new Spring project,
  4. correct any errors that appear in the Spring project,
  5. create the [persistence.xml] file that configures the JPA layer,
  6. create the Spring configuration file. At this point, the [mv-pam-spring-metier] project should be correct. Imagine a JUnit test that proves this,
  7. create a Maven project of type [Web Application],
  8. add the necessary dependencies (JSF and the [métier] layer),
  9. copy the elements of the JSF / EJB project from the previous version into the new JSF / Spring project,
  10. correct any errors that appear,
  11. copy the Spring configuration file from the [mv-pam-spring-metier] project into the web project,
  12. add the code to instantiate the Spring beans to the [ApplicationData] bean,
  13. complete the configuration file [faces-config.xml],
  14. Test the web application.