Since issue #899 a @FeignClient annotated interface will be exposed as a primary bean in spring.
So it cannot be mocked out in tests because then there will be more than one primary bean.
Is it possible to refine the solution of #899 a little bit, so that the primary flag is only set if there is a fallback configured?
Hello @LutzStrobel ,
i had the same problem and solved it with the following workaround:
@EnableFeignClients is put on with @Profile("!test") (If you have this annotation on a class where other configuration is applied, move it to its own configuration class)@Profile("test") and create your mocks in there.It isn't beautiful, but it works. Hope it helps
Duplicate of #1016
Most helpful comment
Hello @LutzStrobel ,
i had the same problem and solved it with the following workaround:
@EnableFeignClientsis put on with@Profile("!test")(If you have this annotation on a class where other configuration is applied, move it to its own configuration class)@Profile("test")and create your mocks in there.It isn't beautiful, but it works. Hope it helps