Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Information Provided
-
4.0.0
-
None
-
$ java -version
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
-
Unknown
Description
The `DefaultMapStructFinder` is unable to locate the `Mapper` classes when running in Spring Boot. Seems to throw an exception calling `PluginHelper.getPackageScanClassResolver(ecc).findByFilter(f -> f.getName().endsWith("Mapper"), names);` inside the `doInit()` method.
You can work around this by creating your own `MapStructFinder`, extending `DefaultMapStructFinder`, overriding the `doInit()` function, and calling `discoverMappings(...)` with each of your `Mapper` classes. That way it doesn't try to scan the classpath to find the `Mapper` classes automatically. I've attached a working example to illustrate.
*Note: It has no issue locating them when running `mvn spring-boot:run`. Only when running from the packaged uber jar with `java -jar ...`.