Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?

简介: Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?

Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?


问题描述

这里是引用


在项目中同时使用 lombok 与mapstruct 包的时候,写了一个mapper,Log与LogDTO里面用了@Getter、@Setter注解


在运行的时候报错 Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?


Mapper(componentModel="spring", unmappedTargetPolicy=ReportingPolicy.IGNORE)
publicinterfaceLogMapper {
@Mappings({
@Mapping(source="id", target="idDTO"),
@Mapping(source="realName", target="realNameDTO"),
@Mapping(source="name", target="nameDTO"),
    })
LogDTOconvertToDTO(Loglog);
@Mappings({
@Mapping(source="idDTO", target="id"),
@Mapping(source="realNameDTO", target="realName"),
@Mapping(source="nameDTO", target="name"),
@Mapping(target="address", constant="无地址"),
    })
LogcovertToDO(LogDTOlogDTO);
}


问题处理

查询了一些资料,有以下几种解决办法,针对我这个情况,是 采用了第三种解决办法,最有效的是下这种


(1)在pom文件中 加入binding 插件


pom.xml -> build-> plugins 下加入 lombok-mapstruct-binding


<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.5.1</version><configuration><source>1.8</source><target>1.8</target><annotationProcessorPaths><path><groupId>org.mapstruct</groupId><artifactId>mapstruct-processor</artifactId><version>1.3.1.Final</version></path><path><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.14</version><!--注意这里的版本号,建议不一样的,要改的和我一样,不然--></path><path><groupId>org.projectlombok</groupId><artifactId>lombok-mapstruct-binding</artifactId><version>0.2.0</version><!--注意这里的版本号,不要更改,用阿里云镜像的,他里面只有这个版本的文件,不然依旧报错--></path></annotationProcessorPaths></configuration></plugin></plugins></build>



其他的就不介绍的了,我试了只有他最有效

相关文章
|
JavaScript API
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
740 0
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
369 4
|
C++ Python
【Azure 应用服务】Azure Function Python函数部署到Azure后遇见 Value cannot be null. (Parameter 'receiverConnectionString') 错误
【Azure 应用服务】Azure Function Python函数部署到Azure后遇见 Value cannot be null. (Parameter 'receiverConnectionString') 错误
224 0
|
JavaScript 前端开发 C++
【Azure Function】调试 VS Code Javascript Function本地不能运行,报错 Value cannot be null. (Parameter 'provider')问题
【Azure Function】调试 VS Code Javascript Function本地不能运行,报错 Value cannot be null. (Parameter 'provider')问题
199 0
|
Java
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
Error:(15, 13) java: No property named “id” exists in source parameter(s). Did you mean “null”?
610 1
|
消息中间件 Java Kafka
Kafka - java.lang.VerifyError: Uninitialized object exists on backward branch 193
Kafka - java.lang.VerifyError: Uninitialized object exists on backward branch 193
252 0
|
JSON Java 数据格式
【Java报错】记录一次 sun.misc.Unsafe.park(Native Method) Conflicting setter definitions for property 导致的内存泄露
【Java报错】记录一次 sun.misc.Unsafe.park(Native Method) Conflicting setter definitions for property 导致的内存泄露
668 0
|
JavaScript API
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
Property ‘proxy‘ does not exist on type ‘ComponentInternalInstance | null‘.ts
|
SQL 关系型数据库 MySQL
实时计算 Flink版产品使用合集之从MySQL同步数据到Doris时,历史数据时间字段显示为null,而增量数据部分的时间类型字段正常显示的原因是什么
实时计算Flink版作为一种强大的流处理和批处理统一的计算框架,广泛应用于各种需要实时数据处理和分析的场景。实时计算Flink版通常结合SQL接口、DataStreamAPI、以及与上下游数据源和存储系统的丰富连接器,提供了一套全面的解决方案,以应对各种实时计算需求。其低延迟、高吞吐、容错性强的特点,使其成为众多企业和组织实时数据处理首选的技术平台。以下是实时计算Flink版的一些典型使用合集。
|
SQL 关系型数据库 MySQL
python在mysql中插入或者更新null空值
这段代码是Python操作MySQL数据库的示例。它执行SQL查询从表`a_kuakao_school`中选取`id`,`university_id`和`grade`,当`university_id`大于0时按升序排列。然后遍历结果,根据`row[4]`的值决定`grade`是否为`NULL`。若不为空,`grade`被格式化为字符串;否则,设为`NULL`。接着构造UPDATE语句更新`university`表中对应`id`的`grade`值,并提交事务。重要的是,字符串`NULL`不应加引号,否则更新会失败。
426 2