Skip to content
Advertisement

Error Injecting FeignClient from another Project

I am having trouble auto wiring a feign client from another project. It appears that the implementation of the feign client is not being generated and injected.

This is the error I am getting.

JavaScript

The feign client is pretty straight forward. I have removed the imports for brevity.

JavaScript

I added the component scan to my project to include the application and it’s controllers and to include the feign client in the other project.

JavaScript

The rest controller with most of the imports removed for brevity.

JavaScript

I have tried defining the feign client interface in different projects and different packages and have only seen success when it put it in the same package as the application. This make be believe that it is a component scan issue even though I am including the package in the scan. I would like to keep the feign client interface in a shared project to define a reusable “contract” and for each project to have a unique package structure instead of defining the feign client with the application using it.

Thanks, Wes.

Advertisement

Answer

You need to tell the Feign scanner where to locate the interfaces.

You can use @EnableFeignClients(basePackages = {"my.external.feign.client.package", "my.local.package"}).

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement