Spring Web Service Response Filtering



Sometimes, mostly in large projects, there is a need to control the serialization of a service response — especially to filter fields of an object in response. For solving this type of issue, we have several solutions. Let’s take a look.


For example, we have an object named “User” that contains fields like: id, email, fullName, password, secretKey. We have a task to return this object to a recipient with different fields depending on the role in the session. Also, we have two types of roles: admin and user:

Source: dzone


Leave a Reply