'MapStruct ignore all unmapped properties for specific method
There are several ways to ignore unmapped target properties in mapstruct.
- We could list all properties to ignore for specific method:
@Mapping(target = "propName", ignore = true)
- Or specify to ignore all properties on mapper level :
@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?
Solution 1:[1]
Using the BeanMapping annotation you can specify this at method level.
@BeanMapping(unmappedTargetPolicy = ReportingPolicy.IGNORE)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ben Zegveld |
