gpt4 book ai didi

java - map 结构/ Lombok : No property named "customfields" exists in source parameter(s) as on Dec 31 2019

转载 作者:行者123 更新时间:2023-12-02 01:10:02 71 4
gpt4 key购买 nike

我看过各种帖子以及 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 似乎是正确的。为什么当属性(property)存在时我仍然遇到问题? (使用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);

关于java - map 结构/ Lombok : No property named "customfields" exists in source parameter(s) as on Dec 31 2019,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59540003/

71 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com