We showed how to use HandlerInterceptorAdapter within your spring MVC application and as your mappings get more complicated you should consider writing unit tests to validate that the correct handler is being applied to URL. Spring Framework 3.2 release included first class support for testing Spring MVC applications is broken into two categories of tests; integration and mocking. The integration approach is more of full on integration test as it loads your entire configuration and the latter just mocks controllers without loading configuration. Since TestContext frameworks caches spring configuration your first test will take a hit but each one after should be fairly speedy. The example below will show how how to validate that a request contains a handler in the execution chain.
If you work in an IBM shop you might be cursing at the fact you have to use WebSphere. The start up and publish times are ridiculous which add to your over all developer cycle time. Publish, wait, restart, get distracted - where was I? Back from coffee... this is in itself should cause just about every developer to go insane and force folks to write unit tests.
OH my goodness, java 8 just was released but you are posting about java 7 features? Sure it has been some time but many developers don't get the luxury within corporate walls to use all the new goodies since most environments are dependent on third party updates. When a third party announces support of a new version of the JDK typically it isn't available for download and production ready like your typical open source package. Internally there is planning, migration of applications, environment set up, testing and a crap load of meetings that occur before use. So while new versions become mainstream it takes years for most version to gain penetration.
I was working on a spring boot project in conjunction with rolling it out to Websphere 8.5.5 and upon deployment we noticed that the System.out.log didn’t display application start up messages like:
[5/29/14 14:27:22:222 CDT] 000000e2 UninstallSche I ADMA5106I: Application ABCY started successfullyIn addition we had some application error configuration with ErrorMvcAutoConfiguration that wasn’t quite right which was due to the need to change servlet mapping on the dispatch servlet. This would in turn cause hung threads and while looking for a message they couldn’t be found. Of course, the server admins said it was an application logging issue and they were afraid to start digging into all the complex logging spring has :).