I appeal to the controller, which must return a list of objects. Objects are converted to a JSON string. When converting objects to a JSON string, all object getters are called. As a result, all object data is returned. How to prevent the return of some fields of the object, maybe there is a special annotation?
@Controller @MessageMapping("/v1.0") public class MyController { @MessageMapping("/getList") @SendTo("/topic/List") public Collection<MyObj> getList() throws Exception { return this.MyObjService.getList(); } }
Actually a class of future objects:
public class MyObj { private String name; private String login; public String getName() { return name; } public String getLogin() { return login; } }
I would like to prohibit the return of the login
field.