我有一个具有属性的实体,我曾经这样写过
私人龙重症监护室;
我正在使用地图结构:
这是我针对所述实体的映射器:
@Mapper(componentModel = "spring")
public interface ProtectionQueryMapper extends EntityMapper<ProtectionQueryDto, Protection> {
ProtectionQueryDto toDto(Protection protection);
Protection toEntity(ProtectionQueryDto protectionQueryDto);
List<Protection> toEntity(List<ProtectionQueryDto> protectionQueryDtos);
List<ProtectionQueryDto> toDto(List<Protection> protections);
}
public interface EntityMapper<D, E> {
E toEntity(D dto);
D toDto(E entity);
List<E> toEntity(List<D> dtoList);
List<D> toDto(List<E> entityList);
}
我遇到的问题是我想将属性从 ICU 更改为 icu,我这样做了,并导致了此错误:
嵌套异常是java.lang.NoSuchMethodError:
Protection.getICU()Ljava/lang/Long;
看起来mapstruct 生成它的getter 和setter 是基于:private Long ICU;
生成方法如 setICU 和 getICU。
但现在我已经将属性从 ICU 更改为 icu mapstruct 并没有将其方法更新为setIcu
and getIcu
.
我无法改变mapstruct
手动生成文件。
这也是我的 pom.xml (至少是关于 mapstruct 的部分)
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.3.0.Final</version>
</dependency>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.3.0.Final</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
知道如何让 mapstruct 更新其生成的源文件吗?