Describe the bug
Feign client initialization is always lazy. As such, the first calling thread triggers the initialization, which may be another Spring component (e.g. REST controller) using CompletableFuture.supplyAsync() to do so. This uses ForkJoinWorkerThread underneath, resulting in a ClassNotFoundException, if and only if running in a dockerized environment based on Spring Boot Build Image plugin.
Using other JVM Executors(except newWorkStealingExecutor), e.g. fixedSizeThreadExecutor(), does not result in this behavior. Also eagerly initializing the Feign client by calling it synchronously, e.g. from within a CommandLineRunner, circumvents this. Once, the Feign client is properly initialized, there is no problem, however, Feign does not yet support eager initialization.
Sample
A sample project with instructions to reproduce is provided here: https://github.com/maverick1601/openfeign-build-image-error
Describe the bug
Feign client initialization is always lazy. As such, the first calling thread triggers the initialization, which may be another Spring component (e.g. REST controller) using
CompletableFuture.supplyAsync()to do so. This usesForkJoinWorkerThreadunderneath, resulting in aClassNotFoundException, if and only if running in a dockerized environment based on Spring Boot Build Image plugin.Using other JVM Executors(except
newWorkStealingExecutor), e.g.fixedSizeThreadExecutor(), does not result in this behavior. Also eagerly initializing the Feign client by calling it synchronously, e.g. from within aCommandLineRunner, circumvents this. Once, the Feign client is properly initialized, there is no problem, however, Feign does not yet support eager initialization.Sample
A sample project with instructions to reproduce is provided here: https://github.com/maverick1601/openfeign-build-image-error