Let's assume I have an Account class, that has a instance variable of Person class.
public class Account {
private String accountId;
private Person person;
// getters and setters
}
public class Person {
private String name;
// getters and setters
}
Now If a form POST body contains the following params:
account.accountId=123&account.person.name=
Spring will instantiate a new Person even though all of its properties are empty (or null, cause I am using a @ControllerAdvice with @InitBinder, where I am setting StringTrimmerEditor for String). Is there a way to instruct Spring not to create the Person instance then?