Spring Migration


This page contains informations about the migration of OpenHospital to Spring framework.

For every module, every layer should be Springified, starting from the lower levels (database access code).

The application entry point is org.isf.menu.gui.Menu.main(), and the Spring Application Context is crated in org.isf.menu.manager.Context.

The configuration file applicationContext.xml was added to the rsc folder. Remember to add that folder to the build path, so that its contents ends up in the classpath while running in Eclipse.

An example: the examination module

This example focuses on Spring-ification of the org.isf.examination.service.ExaminationOperations class.

  1. The @Component annotation was added to the class

  2. The constructor was deprecated, since every instance of this class now should be obtained via Spring ApplicationContext

  3. Static variable session was put inside methods. Spring beans are singleton by default, so they must not keep any state in static variables.

  4. The call to the constructor was replaced with Context.getApplicationContext().getBean(ExaminationOperations.class) in every class it occurs