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:
- 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.
- 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: