MapStruct ignore automatically unmapped properties
For ignore automapping MapStruct 1.3.0.Final Reference Guide:
By means of the @BeanMapping(ignoreByDefault = true) the default behavior will be explicit mapping, meaning that all mappings have to be specified by means of the @Mapping and no warnings will be issued on missing target properties.
@BeanMapping(ignoreByDefault = true)
OneObj map(TwoObj two);
You can set the "unmapped target policy" on the @Mapper
level or via @MapperConfig
to share a setting across several mappers:
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface MyMapper {}