Migrate classic J2EE to Spring (Step 1) (revised)

A couple of months ago I wrote a step 1 on migrating a classis J(2)EE application to a spring based application. Recently I had some time again on my hands and after studying the application and also after some discussions I had I decided to structure the project a little different.

“External” applications

The Adventure Builder applications uses 4 other applications to deliver its services. However in a normal real situation those 4 applications are outside of our control. We cannot change them nor redeploy them. So I decided to just include the ear files for those 4 projects instead of rebuilding them each time.

Generated stubs/skeletons

The application makes use of generated java and xml files. Also in a real situation you should generate those once and after that reuse. You should only (re)generate those files if the external interface changes (best would be to not generate at all). I decided to use the generated java files and xml files and include them in the project. They can be found in the src/generated directory.

Deployment

Deployment is now maven based, maven can start and create a glassfish domain for you. It will create all jms/jdbc/mail resources and deploy the 4 external applications. After that setup you can choose to start glassfish with the normal startServ command or reuse maven to start it. Simply run the setup.bat/setup.sh file from the setup directory. To deploy our own 2 applications simply go to the apps directory and type mvn glassfish:deploy.

Testing

The initial project as is has some test classes available so that we can make sure that the application still behaves as it should behave after we are going to change it to use Spring and Hibernate.

Hopefully Step 2 will follow shortly and that we can have a look at the different steps and easier code.

Advertisements

Migrate classic J2EE to Spring (Step 1)

A few months ago SpringSource released a white paper describing the migration from J2EE to a Spring framework based application. Even before they wrote that white paper I already had the idea of writing something about how to migrate from J2EE to a Spring based application. However Colin Sampaleanu (at al.) beat me to writing the white paper :).

However I also had the idea of providing some practical information like a sample. The white paper gives some thought on what to do and where but it doesn’t give a clear sample. So I started writing a possible migration path (multi step sample) from a J2EE application to a Spring based application.
Continue reading “Migrate classic J2EE to Spring (Step 1)”