While serializing java objects to JSON and deserializing JSON to Java Objects, sometimes one would want to ignore the property only while serializing but allow the property to be deserialized into Java object property. On a similar note there can be a requirement where a property has to be ignored only while deserializing into java object property but the property has to be allowed to be serialized.

Suppose we have a backend service in an application which stores the Customer details of the application like name,telephone,password etc.Supposing the Customer object structure to be below.

public class Customer {…


Spring Boot 2.2.0 comes with a handy feature which can be utilized to reduce the application start up time by deferring the bean creations and dependency injections to later time thereby quickening the application start up time.

Spring beans creation will be initiated only when needed by Lazy initializing the bean creation and dependency injections.

Lazy Initialization is already possible in previous versions of spring boot but then to enable lazy initialization one need to implement BeanFactoryPostProcessor. Spring boot 2.2.0 offers a simple way to enable lazy initialization of beans.

There is a property added newly that will enable/disable lazy…


When you want to apply a specific color to an image using java,it can be done using the BufferedImage class.

As we know that images are made up of pixels and each pixel is represented by it’s red,green,blue values which range from 0 to 255.So,to represent a color in each pixel these red,green,blue values has to be mixed in the appropriate proportion required to obtain the desired color to the pixel.

An example program to achieve the effect of applying a color layer to an image is given below:

package com.example.demo;

import java.io.File;
import java.io.IOException;
import java.awt.image.BufferedImage;
import java.util.Scanner;
import javax.imageio.ImageIO;

public class ImageColorFilter{…


When you are using Java.util package’s classes like Date,Calendar etc ,quite often than not one would need to get the date or Calendar populated with current date,time.

In such cases,we can obtain that using below

Date currentDate = new Date();
Calendar currentCalendar = Calendar.getInstance();

Let’s say we want to print these values.When we print the values to console, the values that will be output to console will be something like this.

System.out.println(currentDate);
System.out.println(currentCalendar);
------------------------------------
Output:
Tue Jun 19 20:02:38 IST 2018
Tue Jun 19 20:02:38 IST 2018

You can see the output value being shown is represented in the underlying…


Generally, while creating a Rest application using Spring one would leverage Jackson’s message converter to convert the received JSON onto domain object in java i.e typically a POJO.

Example: Let’s say there is a request which we need to send to the service then that has to be de-serialized to a Java object.Java object would be this:

package com.example.demo;public class Request {
private String firstName;
private String lastName;
private int age;

public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {…

Sai Pitchuka

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store