mapstruct注入失败

yuvru6vn  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(476)

我正在尝试用lombok实现mapstruct。下面是pom.xml。
pom.xml文件

  1. <parent>
  2. <groupId>com.dbcc.ecomm</groupId>
  3. <artifactId>ecomm</artifactId>
  4. <version>1.0</version>
  5. <relativePath>../pom.xml</relativePath>
  6. </parent>
  7. <properties>
  8. <org.mapstruct.version>1.3.0.Final </org.mapstruct.version>
  9. <org.projectlombok.version>1.12.6</org.projectlombok.version>
  10. </properties>
  11. <build>
  12. <testResources>
  13. <testResource>
  14. <directory>src/test/resources</directory>
  15. <filtering>true</filtering>
  16. </testResource>
  17. </testResources>
  18. <pluginManagement>
  19. <!-- Package up tests so we can re-use utilities and support classes -->
  20. <plugins>
  21. <plugin>
  22. <groupId>org.apache.maven.plugins</groupId>
  23. <artifactId>maven-jar-plugin</artifactId>
  24. <executions>
  25. <execution>
  26. <goals>
  27. <goal>test-jar</goal>
  28. </goals>
  29. </execution>
  30. </executions>
  31. </plugin>
  32. <plugin>
  33. <groupId>org.apache.maven.plugins</groupId>
  34. <artifactId>maven-compiler-plugin</artifactId>
  35. <configuration>
  36. <annotationProcessorPaths>
  37. <path>
  38. <groupId>org.mapstruct</groupId>
  39. <artifactId>mapstruct-processor</artifactId>
  40. <version>${org.mapstruct.version}</version>
  41. </path>
  42. <path>
  43. <groupId>org.projectlombok</groupId>
  44. <artifactId>lombok</artifactId>
  45. <version>${org.projectlombok.version}</version>
  46. </path>
  47. <path>
  48. <groupId>org.projectlombok</groupId>
  49. <artifactId>lombok-mapstruct-binding</artifactId>
  50. <version>0.2.0</version>
  51. </path>
  52. </annotationProcessorPaths>
  53. <compilerArgs>
  54. <compilerArg>
  55. -Amapstruct.defaultComponentModel=spring
  56. </compilerArg>
  57. </compilerArgs>
  58. </configuration>
  59. </plugin>
  60. </plugins>
  61. </pluginManagement>
  62. </build>
  63. <dependencies>
  64. <dependency>
  65. <groupId>org.mapstruct</groupId>
  66. <artifactId>mapstruct-jdk8</artifactId>
  67. <version>1.3.0.Final</version>
  68. </dependency>
  69. <dependency>
  70. <groupId>org.mapstruct</groupId>
  71. <artifactId>mapstruct-processor</artifactId>
  72. <version>1.3.0.Final</version>
  73. <scope>provided</scope>
  74. </dependency>
  75. </dependencies>

Map器.java

  1. @Mapper(componentModel = "spring")
  2. public interface Mapper {
  3. @Mappings({ @Mapping(source = "sourceName", target = "source"),
  4. @Mapping(source = "subscriber", target = "subscriberId"),
  5. @Mapping(source = "fulfilledDate", target = "fulfilledDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") })
  6. PhxVboProofOfDelivery mapPhxVboProofOfDeliveryDtoToPhxVboProofOfDelivery(
  7. PhxVboProofOfDeliveryVO phxVboProofOfDeliveryVO);
  8. default PhxVboProofOfDelivery addParameterManually(PhxVboProofOfDelivery vboProofOfDelivery,
  9. @Context PhxVboSyncRecord phxVboSyncRecord) {
  10. vboProofOfDelivery.setCreatedBy(DbccConstants.PHX_VBO_POD_SUBSCRIBER);
  11. vboProofOfDelivery.setLastModifiedBy(DbccConstants.PHX_VBO_POD_SUBSCRIBER);
  12. vboProofOfDelivery.setCreatedDate(CommonUtil.getTodaysDateandTime());
  13. vboProofOfDelivery.setLastModifiedDate(CommonUtil.getTodaysDateandTime());
  14. vboProofOfDelivery.setPhxVboSyncRecord(phxVboSyncRecord);
  15. return vboProofOfDelivery;
  16. }

一旦我尝试从eclipse sts构建应用程序,它就可以正常工作了。impl文件正在目标文件夹中生成。当我尝试将war文件部署到tomcat并启动应用程序时,出现以下错误。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题