[
https://issues.apache.org/jira/browse/CAMEL-20664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-20664.
---------------------------------
Resolution: Information Provided
> camel-mapstruct - MapStruct mappers not found in Spring Boot
> ------------------------------------------------------------
>
> Key: CAMEL-20664
> URL: https://issues.apache.org/jira/browse/CAMEL-20664
> Project: Camel
> Issue Type: Bug
> Components: camel-mapstruct
> Affects Versions: 4.0.0
> Environment: $ 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)
> Reporter: Josh Reagan
> Priority: Minor
> Fix For: 4.4.0
>
> Attachments: camel-mapstruct-demo.zip
>
>
> 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 ...`.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)