Ignoring Unrecognized JSON Fields With Spring & Jackson

March 13, 2015 by

If you try to bind JSON to an object in Spring MVC with Jackson, then you might have seen the below error before. Could not read JSON: Unrecognized field \”something\” (class com.codingexplained.user.dto.account), not marked as ignorable […] This error occurs whenever an unknown field is encountered in the JSON; that is, a field specified in the JSON is not… read more

Moving .ebextensions to root in .war file

March 6, 2015 by

If you wish to deploy your application to Amazon’s Elastic Beanstalk, then you can customize your server setup by placing configuration files within a .ebextensions directory within the root of your .war file (for web applications). These files can then contain various kinds of instructions. One can install packages with package managers such as yum or… read more

Unpacking War File on OS X and Linux

March 6, 2015 by

If you have packaged a web application within a .war file, then you might want to check the contents of it for various reasons. There are a number of tools that can do this, but I am going to show you a simple command that can display the contents of the war file within the… read more

Date Parameter in Spring MVC Controller

March 1, 2015 by

Need to pass a date as a java.util.Date instance in a Spring MVC controller action? Then you have come to the right place. You might have tried the below approach and encountered a good old 404 Not Found error. @Controller public class CompanyController { @RequestMapping("/company/added-since/{since}") public String showAddedSince(@PathVariable("since") Date since) { return "companies-added-since"; } }… read more

Neither BindingResult nor plain target object available as request attribute

February 21, 2015 by

If you are trying to bind a Spring MVC form to a bean, then you might have come across the below exception. Neither BindingResult nor plain target object for bean name ‘mybean’ available as request attribute Some tutorials claim that you can do like this: @Controller public class PersonController { @RequestMapping(value = "/person/add", method =… read more

The Singleton Pattern

July 22, 2012 by

The singleton pattern is one of the most popular and well known patterns in software development. It is extremely simple and yet solves a fundamental and common problem. However, as this article discusses, everything has a cost.