Mapstrut/Lombok:截至 2019 年 12 月 31 日,源参数中不存在名为 "customfields" 的 属性
Mapstrut/Lombok: No property named "customfields" exists in source parameter(s) as on Dec 31 2019
我看过各种帖子以及 Lombok Github 帐户,其中与映射 属性 未找到相关的问题处于关闭状态。
但我在用例中遇到问题:
POM.XML
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
界面
@Mapping(source = "customfields", target = "customfields", ignore = true)
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
错误:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/EvryIntegrator/Projects/Snow/src/main/java/com/integrator/snow/util/LicenseMapper.java:[13,9] No property named "customfields" exists in source parameter(s). Did you mean "empty"?
根据各种堆栈溢出帖子,pom 似乎是正确的。为什么 属性 存在时我仍然遇到问题? (使用 eclipse 2019)
使用 @Mapping
时,源和目标将应用于映射的实际数据。在您的情况下,MapStruct 正在 java.util.List
中寻找名为 customFields
的 属性。
试试这个
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
@Mapping(source = "customfields", target = "customfields", ignore = true)
License map(com.integrator.snow.vo.license.License source);
我看过各种帖子以及 Lombok Github 帐户,其中与映射 属性 未找到相关的问题处于关闭状态。
但我在用例中遇到问题:
POM.XML
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
界面
@Mapping(source = "customfields", target = "customfields", ignore = true)
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
错误:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/EvryIntegrator/Projects/Snow/src/main/java/com/integrator/snow/util/LicenseMapper.java:[13,9] No property named "customfields" exists in source parameter(s). Did you mean "empty"?
根据各种堆栈溢出帖子,pom 似乎是正确的。为什么 属性 存在时我仍然遇到问题? (使用 eclipse 2019)
使用 @Mapping
时,源和目标将应用于映射的实际数据。在您的情况下,MapStruct 正在 java.util.List
中寻找名为 customFields
的 属性。
试试这个
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
@Mapping(source = "customfields", target = "customfields", ignore = true)
License map(com.integrator.snow.vo.license.License source);