Recently I was working on a Spring MVC project. I had an @RequestMapping where one of the method’s @RequestParam arguments was a java.util.Date type. I didn’t think much of it as I was writing the method, until when I tested the application, it threw an exception. I quickly discovered that there’s no String to Date converter registered by default.
And that’s all there is to it. Simply replace the SimpleDateFormat pattern with the pattern you need in your application, register the conversion service in your MVC config as mentioned in my previous post and voila!