January 16, 2025

JSON Serialization - How to Preserve the Type with Jackson
Learn how to preserve type information during JSON serialization and deserialization using Jackson. This guide explains best practices, including the use of @JsonTypeInfo and enabling default typing, to maintain object structure while working with polymorphic types in Java. Read More
by
Phee Jay
January 03, 2025

Java - How to create Immutable Classes in Java
Discover how to create immutable classes in Java with step-by-step guidance, key principles, and best practices for designing secure and robust objects. Read More
by
Phee Jay
January 28, 2019

Spring MVC - How to handle errors from a controller?
In a web application, it is very important to handle errors. Proper error handling would protect the application from several vulnerabilities, including Security Misconfiguration . In this post, you will see how you can handle exceptions that arise out of a Spring MVC based application. Read More
by
Phee Jay
January 25, 2019

Java - How to find the IP Address of a host in Java ?
In Java, if you are looking to resolve an IP Address from the given hostname, then you can leverage the capabilities provided by InetAddress . It belongs to the "java.net" package and provides various utilities related to resolving addresses and IPs. Read More
by
Phee Jay
April 13, 2017

Spring - Localization with Spring
Localization enables applications to cater to users of different locations and languages. Spring, as usual, has support for this aspect as well. Before jumping into what Spring has to offer, let's explore what we get from Java itself. Read More
by
Phee Jay
March 04, 2017

Java - Deep Copy Java Objects through Serialization
When it comes to deep copy or cloning an object, the first thing that comes to mind is to override the clone() method and set each field manually. This can be pretty cumbersome to implement for complex objects or if you have to do this for a lot of them. Read More
by
Phee Jay
February 17, 2017

Jackson - JSON Property Name Customization in Jackson using PropertyNamingStrategy
Jackson is one of the most popular java libraries for serialization/deserialization of POJOs to/from JSON. By default, Jackson derives the JSON element names from the getter/setter method names of the POJO. e.g. getActorName() is translated to actorName in the resulting JSON. Read More
by
Phee Jay