MapStruct ignore automatically unmapped properties

前端 未结 2 2089
执念已碎
执念已碎 2020-12-09 02:24

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

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 02:56

    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 {}
    

提交回复
热议问题