For the microservice with basic CRUD operation and there is an interface to add resources in bulk(array of resources). Here we want to have a restriction of payload size to 1024KB(1MB). If the POST request payload size is >1MB then 400 bad request should be thrown else process the request.
By default the spring boot application marshal the json to Resource object.
Here I don't want to rely on content-length header and don't want to convert the object back to string to find the byte size.