spring – 使用MapStruct将实体映射到DTO
我是maptruct中的新手,我使用spring作为DI我跟进了关于DI容器的MapStruct文档页面4.2我尝试将我的实体映射到dto,如下所示:
@Mapper(componentModel = "spring")
public interface CustomerMapper {
@Mapping(source = "registered",target = "activeProfile")
CustomerDto customerToCustomerDto(Customer customer);
}
当我运行mvn install时出现此错误:
java:27: error: No property named "registered" exists in source parameter(s).
@Mapping(source = "registered",target = "activeProfile")
我的实体使用lombok,我相信有注册的字段
请帮忙