Mapstruct使用问题Couldn't retrieve @Mapper annotation

xiaoxiao2021-02-28  132

Mapstruct使用问题Couldn’t retrieve @Mapper annotation

在同时使用swagger和mapstruct-jdk8的时候会报错:Couldn't retrieve @Mapper annotation

这个错误解释:

This actually is not a problem on our side. We have 2 packages, mapstruct and mapstruct-jdk8. The problem seems to occur when you have both on the classpath.

You don’t need to exclude the entire swagger for this. You can do this to only exclude the Mapstruct dependency that swagger2 brings with itself:

<groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>${swagger2.version}</version> <exclusions> <exclusion> <artifactId>org.mapstruct</artifactId> <groupId>mapstruct</groupId> </exclusion> </exclusions> </dependency>
转载请注明原文地址: https://www.6miu.com/read-35267.html

最新回复(0)