Код: Выделить всё
@Autowired MyMapper myMapper
Код: Выделить всё
MyMapper myMapper=Mappers.getMaper(MyMapper.class)
nb: MainMapper использует MyMapper, а MyMapper использует Mapper2
mainMapper:
Код: Выделить всё
@Mapper(componentModel = "spring",
unmappedTargetPolicy = ReportingPolicy.IGNORE,
uses = MyMapper.class ,
nullValueMappingStrategy = NullValueMappingStrategy.RETURN_NULL)
public interface MainMapper {
@Mappings({ @Mapping(target = "year", source = "Period.year") })
Resource toResource(MyObject myObject);
@Mapping(target = "Period.year", source = "year")
MyObject toModel(Resource resource);
}
Код: Выделить всё
@Mapper(componentModel = "spring",
unmappedTargetPolicy = ReportingPolicy.IGNORE,
uses = Mapper2.class,
nullValueMappingStrategy = NullValueMappingStrategy.RETURN_NULL)
public interface MyMapper {
RequestResource toResource(Request request);
Request toModel(RequestResource requestResource);
}
Подробнее здесь: https://stackoverflow.com/questions/603 ... ll-in-test
Мобильная версия