I would like to know how to copy the properties from an Object Source to an Object Dest ignoring null values using Spring Framework.
I actually use Apache beanutil
I advise you to use ModelMapper.
This is a sample code that solves your doubt.
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setSkipNullEnabled(true).setMatchingStrategy(MatchingStrategies.STRICT);
Company a = new Company();
a.setId(123l);
Company b = new Company();
b.setId(456l);
b.setName("ABC");
modelMapper.map(a, b);
System.out.println("->" + b.getName());
It should print the B value. But if you set the "A" name, the result is a print of "A" value.
The secret is changing the value of SkipNullEnabled to true.
ModelMapper
ModelMapper MVN