Spring Migration Analyzer – The Beginning

Posted in java, spring, springframework by pedro | Monday, December 24th, 2012 at 10:56 am

Spring Team surprised us once again with Spring Migration Analyzer tool. Migration with Spring wasn’t so painful, BUT this one create report for us. Now it easier to estimate effort and we now spots where we should put our attention.

I read InfoQ article: “Spring Migration Analyzer: An Assistant For JavaEE To Spring Conversion” about great features and possibilities, but I rather do not belief until I touch :).

Now guys have a lot to do but in some point SMA should be able to run just on sources (especially if this is ant, ivy, maven or gradle project).

I ran this tool in this projects:

  1. open source project (war – 30Mb) with spring 3.1, guava, hibernate – nothing fancy
    • First run: java.lang.OutOfMemoryError: Java heap space -> so I add more heap, and rerun.
    • Second run (512M) - ”Poller SunPKCS11-Darwin” java.lang.OutOfMemoryError: Java heap space -> so I found SMA-21 - fix in M2 – let’s switch do suggested nightly build
    • While third build was running I checked M2 fixes – so my advice is use nightly build.
    • Third run (1Gb – nighty) : 1m10.842s (real):  Nothing special, and a lot of false positives, as example the migrator assumes that I handle transaction programmatically because in org.springframework.transaction.jta.ManagedTransactionAdapter I’m using void public commit() and that is quite opposite ;) .
    • OK – let assume it will work better when, there is no spring yet.
  2. some secret project (zip 10Mb) guice no j2ee, no spring at all.
    • First run : 0m14.807s : look promising.
    • Two findings
      • The application utilises the JMS API. Typically, little or no migration is required as JMS can be used within Tomcat. During the migration, it may be worth considering using Spring’s JMS support, for example JmsTemplate, to simplify the code.
      • The application utilises the JNDI API. JNDI is available in Tomcat and therefore no work is required to migrate the application. However, it may be worth considering using Spring’s <jee-jndi-lookup> support to perform any JNDI lookups, rather than using the JNDI API directly.
    • BUT grep -rial “jms” src/  -> nothing same for jndi
    • Fail once again

I’ve skipped checking another one, as the project started, there is no point to kick the Younglings

They’are just started (SMA-24 do not exists) and  from my point of view it might be a good tool in the future: My ideas are:

  • automatic exclusion on common names: eg. org.springframework
  • working with source code
  • understanding dependencies (most java project are managed by ivy,maven,gradle)

Anyway, it worth to now that such tool as Spring Migration Analyzer is rising, or now it is the best time to join and help a little bit:

about me

My name is Sebastian Pietrowski. I've finished Warsaw University as Master degree. During my studies I started work for merlin.pl. The primary language I use is Java but I have also programmed in Python, Ruby and Scala. I worked as a technical solution architect at merlin.pl. infrastructure when we were moving from PL/SQL to J2EE. I engineering a great performance optimized solution that made the application 10 times faster than requirements and 85 times faster as original solution.

Currently, I am working as a Senior Expert at F.Hoffmann-La Roche to help define future roadmap in design and development of Enterprise software at Roche and Genentech and build adoption for new technologies. I'm continuously mentoring new developers, helping them understand how important test driven development is and empowering them to get better at their daily job. I'm involved in many activities which brings new technologies for better and faster development. You can find more details on my LinkedIn profile.

But don’t get me wrong, I am not your typical nerd. I'm a pleasant guy that you can drink a glass of wine with me and talk about a range of topics with. My leisure activities include playing basketball, soccer and listening to music. I try to be pragmatic while staying focused on application performance and tuning with success in my daily work.

My favorite quote from Yoda's and my life’s motto is: Do, or do not. There is no try.