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>mapstruct</artifactId> <groupId>org.mapstruct</groupId> </exclusion> </exclusions> </dependency>