There are several ways to ignore unmapped target properties in mapstruct.
@Mapping(target = "propName", ignore = true)
@Mapper(
unmappedTargetPolicy = ReportingPolicy.IGNORE
)
Is there a way to mix these approaches and ignore all properties at the method level without explisently list all of them?
Using the BeanMapping annotation you can specify this at method level.
@BeanMapping(unmappedTargetPolicy = ReportingPolicy.IGNORE)
The javadoc can be found here.
if you are using version 1.4, you can annotate your mapping method with @BeanMapping(ignoreByDefault = true)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With