When using Spring MVC, by default, whenever your @RestControllers return an object, it will be serialized into a JSON based on its getters, instead of its fields.
Is there any way I can configure Micronaut to behave like this as well? Example:
public class User {
private String email;
private String password;
public String getEmail() {
return email;
}
}
@Controller
public class UserController {
public User getUser() {
...
}
}
So this should return:
{
"email": "email@addres.com"
}
instead of this:
{
"email": "email@addres.com",
"password": "pass"
}
I'm aware of Jackson's annotations, however, I'm just trying to understand if it's possible to configure Micronaut to behave like this.
Thanks.