See https://github.com/spring-projects/spring-boot/issues/21379 for more background.
It would be helpful if FeignClientsRegistrar could add a FactoryBean.OBJECT_TYPE_ATTRIBUTE attribute to the registered bean definition. The value of the attribute should be the type of bean that the FeignClientFactoryBean will ultimately create.
With such an attribute in place, it will be possible for Spring Boot's @MockBean support to tell the type without needing to instantiate the factory bean.
Comment From: spencergibb
@philwebb something like this?
beanDefinitionBuilder.addPropertyValue(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className);
Comment From: spencergibb
@MPoorter I'm unable to recreate the issue to validate a fix. I've copied code from https://github.com/spring-cloud/spring-cloud-openfeign/issues/336#issue-615199547 but the mock bean works without errors.
Comment From: philwebb
@spencergibb It needs to be added to the attributes. Something more like this:
beanDefinitionBuilder.getBeanDefinition()
.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className);
Comment From: spencergibb
ah, I figured I was missing something. Thanks @philwebb
Comment From: spencergibb
@MPoorter can you try Hoxton.BUILD-SNAPSHOTS?
Comment From: maresja1
@spencergibb Just hit the same problem and it seems to be resolved in Hoxton.BUILD-20200515.034536-2455. Thx.