我正在尝试用lombok实现mapstruct。下面是pom.xml。
pom.xml文件
<parent>
<groupId>com.dbcc.ecomm</groupId>
<artifactId>ecomm</artifactId>
<version>1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<org.mapstruct.version>1.3.0.Final </org.mapstruct.version>
<org.projectlombok.version>1.12.6</org.projectlombok.version>
</properties>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>
<pluginManagement>
<!-- Package up tests so we can re-use utilities and support classes -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<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>${org.projectlombok.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>1.3.0.Final</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.3.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
Map器.java
@Mapper(componentModel = "spring")
public interface Mapper {
@Mappings({ @Mapping(source = "sourceName", target = "source"),
@Mapping(source = "subscriber", target = "subscriberId"),
@Mapping(source = "fulfilledDate", target = "fulfilledDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") })
PhxVboProofOfDelivery mapPhxVboProofOfDeliveryDtoToPhxVboProofOfDelivery(
PhxVboProofOfDeliveryVO phxVboProofOfDeliveryVO);
default PhxVboProofOfDelivery addParameterManually(PhxVboProofOfDelivery vboProofOfDelivery,
@Context PhxVboSyncRecord phxVboSyncRecord) {
vboProofOfDelivery.setCreatedBy(DbccConstants.PHX_VBO_POD_SUBSCRIBER);
vboProofOfDelivery.setLastModifiedBy(DbccConstants.PHX_VBO_POD_SUBSCRIBER);
vboProofOfDelivery.setCreatedDate(CommonUtil.getTodaysDateandTime());
vboProofOfDelivery.setLastModifiedDate(CommonUtil.getTodaysDateandTime());
vboProofOfDelivery.setPhxVboSyncRecord(phxVboSyncRecord);
return vboProofOfDelivery;
}
一旦我尝试从eclipse sts构建应用程序,它就可以正常工作了。impl文件正在目标文件夹中生成。当我尝试将war文件部署到tomcat并启动应用程序时,出现以下错误。
暂无答案!
目前还没有任何答案,快来回答吧!