I am using MapStruct with big models (more than 50 fields) shared between different business use cases in my code. Depending on the entry point, some properties will be mapp
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 {}