我最近与 ModelMapper 合作,我有一个问题。我正在尝试将我的 CustomerRequest 映射到 Commercetools CustomerDraftDsl 类。
@Component
public class CreateCustomerCommandMapper extends PropertyMap<CustomerRequest, CustomerDraftDsl> {
protected void configure() {
map().withFirstName(source.getFirstName());
}
我的方法:
public void createCustomer(CustomerRequest customer) {
CustomerDraftDsl draft = mapper.addMappings(new CreateCustomerCommandMapper()).map(customer);
System.out.println(draft);
executeRequestBlocking(CustomerCreateCommand.of(draft));
}
我究竟做错了什么?为什么我无法将我的请求映射到商务工具类?
我得到了这样的回应:
ModelMapper configuration errors:
1) Failed to configure mappings