【SpringBoot + MapStruct】SpringBoot简单整合MapStruct,解决生成对象没有赋值的问题

时间:2025-03-18 08:15:47
<plugin> <groupId></groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${}</source> <target>${}</target> <encoding>UTF-8</encoding> <annotationProcessorPaths> <!-- 此处,lombok依赖一定要放在,Mapstruct-processor依赖之前。否则,生成了maptruct的实现类,但该类只创建了对象,没有进行赋值 --> <path> <groupId></groupId> <artifactId>lombok</artifactId> <version>${}</version> </path> <path> <groupId></groupId> <artifactId>lombok-mapstruct-binding</artifactId> <!-- 如果是0.1.0 有可能出现生成了MapStruct的实现类,但该类只创建了对象,没有进行赋值 --> <version>0.2.0</version> </path> <path> <groupId></groupId> <artifactId>mapstruct-processor</artifactId> <version>${}</version> </path> </annotationProcessorPaths> </configuration> </plugin>