A continuation of PR #2074.
Currently the following mechanism is used when there is more than one constructor on the target bean:
- If a parameterless constructor exists then this constructor would be used
- If a constructor is annotated with an annotation named
@Default (from any package) then this constructor would be used
Based on feedback from users we can offer to define the target constructor parameters in order to pick the appropriate constructor to be used.
e.g.
A Person with 2 constructors:
public class Person {
public Person(String name) {
// initialize
}
public Person(String name, String surname) {
// initialize
}
}
To pick a constructor something like the following can be used:
@BeanMapping(targetConstructorProperties = { "name", "surname" }
A continuation of PR #2074.
Currently the following mechanism is used when there is more than one constructor on the target bean:
@Default(from any package) then this constructor would be usedBased on feedback from users we can offer to define the target constructor parameters in order to pick the appropriate constructor to be used.
e.g.
A
Personwith 2 constructors:To pick a constructor something like the following can be used: