Skip to content

springboot 3.2 app not starting with reactive feign in class path #651

Closed

Description

@jbaddam17

Invalid value type for attribute 'factoryBeanObjectType': java.lang.String

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:183) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:428) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:289) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:775) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:597) ~[spring-context-6.1.1.jar:6.1.1]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) ~[spring-boot-3.2.0.jar:3.2.0]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) ~[spring-boot-3.2.0.jar:3.2.0]
	at u.s.apigateway.ApiGatewayApplication.main(ApiGatewayApplication.java:30) ~[classes/:na]
Caused by: java.lang.IllegalArgumentException: **Invalid value type for attribute 'factoryBeanObjectType': java.lang.String**
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBeanFromAttributes(FactoryBeanRegistrySupport.java:86) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:838) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:620) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:573) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:532) ~[spring-beans-6.1.1.jar:6.1.1]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:247) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:240) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:230) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:183) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:158) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-3.2.0.jar:3.2.0]
	... 17 common frames omitted

using following version

openJDK17
spring-cloud.version 2023.0.0
spring boot parent version 3.2.0
feign-reactor-spring-cloud-starter version 4.0.3

NOTE: Application started normally after removing reactive feign from class path

Activity

  1. ramzes3333 commented on Dec 11, 2023

    @ramzes3333

    Following fix should solve the problem:

    Index: feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java
    --- a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java	(revision 01ff94d5eafceaa49c1ca2aee1928a8808ae56b9)
    +++ b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java	(date 1702303241012)
    @@ -178,7 +178,8 @@
     
     		String alias = name + "ReactiveFeignClient";
     		AbstractBeanDefinition beanDefinition = definition.getBeanDefinition();
    -		beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className);
    +		Class<?> type = ClassUtils.resolveClassName(className, null);
    +		beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, type);
     
     		boolean primary = (Boolean)attributes.get("primary"); // has a default, won't be null
     
    
  2. added a commit that references this issue on Dec 11, 2023
  3. zzzzizu123 commented on Dec 11, 2023

    @zzzzizu123

    Hey, @ramzes3333

    I am using the reactive feign client solution. Are you going to release a version with the fix, or should I use your example as solution in my code.

    however, how can I implement your solution in my code?

    Thanks ahead.

  4. ramzes3333 commented on Dec 11, 2023

    @ramzes3333

    I think it's best to wait for the authors to release an official package with this fix. For testing purposes, you can clone my fork with this fix, build it, and integrate it into your project.

  5. zzzzizu123 commented on Dec 17, 2023

    @zzzzizu123

    Thanks @ramzes3333
    I used your solution and it seems to be working.
    I encountered another issue that happens according to this: spring-projects/spring-boot#38536

    We get run error of finding multiple beans for feignConvrtionService.
    The solution should be to modify
    <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.11.0</version> <configuration> <parameters>true</parameters> </configuration> </plugin>

    As described here:
    https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#core-container:~:text=jndi%2Dlookup%3E.-,Parameter%20Name%20Retention,-LocalVariableTableParameterNameDiscoverer%20has%20been

  6. zzzzizu123 commented on Dec 17, 2023

    @zzzzizu123

    Do you have any estimation when the version with the fix will be released?
    Thanks, ahead

  7. ramzes3333 commented on Dec 18, 2023

    @ramzes3333

    Do you have any estimation when the version with the fix will be released? Thanks, ahead

    @zzzzizu123 Unfortunately, I do not have the knowledge of when the version with the fix will be released. I am not the owner of this repository. Just like you, I use this library and want to use it together with Spring Boot in version 3.2 :)

  8. fflandrin-yseop commented on Jan 5, 2024

    @fflandrin-yseop

    We are having the same issue. Using @ramzes3333 fork works great as a temporary fix while waiting for a release with a permanent fix.

  9. Ahoo-Wang commented on Jan 18, 2024

    @Ahoo-Wang
  10. miwurster commented on Feb 12, 2024

    @miwurster

    Following fix should solve the problem:

    Index: feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java
    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    ===================================================================
    diff --git a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java
    --- a/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java	(revision 01ff94d5eafceaa49c1ca2aee1928a8808ae56b9)
    +++ b/feign-reactor-spring-configuration/src/main/java/reactivefeign/spring/config/ReactiveFeignClientsRegistrar.java	(date 1702303241012)
    @@ -178,7 +178,8 @@
     
     		String alias = name + "ReactiveFeignClient";
     		AbstractBeanDefinition beanDefinition = definition.getBeanDefinition();
    -		beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, className);
    +		Class<?> type = ClassUtils.resolveClassName(className, null);
    +		beanDefinition.setAttribute(FactoryBean.OBJECT_TYPE_ATTRIBUTE, type);
     
     		boolean primary = (Boolean)attributes.get("primary"); // has a default, won't be null
     
    

    Hey guys, is there a plan to release this fix somehow soon(ish)?

  11. Jardo-51 commented on Feb 14, 2024

    @Jardo-51

    EDIT: this solution doesn't work if you need to use any extended functionality, such as request interceptors

    I managed to figure out a workaround to use the solution from @ramzes3333 without having to build my own version of the entire project.

    1. Copy the implementation of ReactiveFeignClientsRegistrar into your project. It uses a couple of package-private classes. You have to copy those as well.
    2. Make the fix suggested by @ramzes3333
    3. Copy the annotation @EnableReactiveFeignClients into your project and modify the @Import annotation to use your custom implementation of ReactiveFeignClientsRegistrar
    4. Modify your implementation of ReactiveFeignClientsRegistrar to use your custom implementation of @EnableReactiveFeignClients (from the previous step).
    5. Define a bean of type FormattingConversionService and mark it as @Primary

    And that's it. Happy coding :)

  12. tomaszwasik commented on Feb 19, 2024

    @tomaszwasik

    Hey guys, is there a plan to release this fix somehow soon(ish)?

  13. sahassakhare commented on Feb 27, 2024

    @sahassakhare

    Hi team, any plans to release spring boot 3.2.x compatible version ?

  14. caosDvlp commented on Feb 27, 2024

    @caosDvlp

    Hi Guys! I'm in the same state as the rest, any plasn to release spring boot 3.2.x compatible version ?

  15. 9you commented on Apr 10, 2024

    @9you

    I managed to figure out a workaround to use the solution from @ramzes3333 without having to build my own version of the entire project.

    1. Copy the implementation of ReactiveFeignClientsRegistrar into your project. It uses a couple of package-private classes. You have to copy those as well.
    2. Make the fix suggested by @ramzes3333
    3. Copy the annotation @EnableReactiveFeignClients into your project and modify the @Import annotation to use your custom implementation of ReactiveFeignClientsRegistrar
    4. Modify your implementation of ReactiveFeignClientsRegistrar to use your custom implementation of @EnableReactiveFeignClients (from the previous step).
    5. Define a bean of type FormattingConversionService and mark it as @Primary

    And that's it. Happy coding :)

    This solution not working with Load Balancer and Resilience4 :(

  16. kyra-ohare commented on Apr 16, 2024

    @kyra-ohare

    Hi
    I would also love to know when this will be Spring Boot 3 compatible. Please.

  17. ChiragMoradiya commented on May 8, 2024

    @ChiragMoradiya

    Hi, we also encountered the same issue. This limits us to upgrade spring-boot to 3.1 only. Is there any timeline planned for the fix?

  18. Jardo-51 commented on May 8, 2024

    @Jardo-51

    I have created a fork of @ramzes3333's fix and published a new version to Maven Central, to make it available for everyone.

    Just replace the starter dependency in your pom.xml with this, and it should work:

    		<dependency>
    			<groupId>com.jardoapps.reactivefeign</groupId>
    			<artifactId>feign-reactor-spring-cloud-starter</artifactId>
    			<version>4.1.0</version>
    			<type>pom</type>
    		</dependency>

    If you need any other modules, just replace the groupId with com.jardoapps.reactivefeign and the version with 4.1.0.

  19. ChiragMoradiya commented on May 9, 2024

    @ChiragMoradiya

    Thanks @Jardo-51 we will try it for sure.

  20. ramzes3333 commented on May 10, 2024

    @ramzes3333

    Hi, we also encountered the same issue. This limits us to upgrade spring-boot to 3.1 only. Is there any timeline planned for the fix?

    I think the project is abandoned. In my project, I replaced Feign Reactive with a pure solution based on WebClient.

  21. Jardo-51 commented on May 10, 2024

    @Jardo-51

    I think the project is abandoned.

    That's the reason why I decided to fork it and publish a new version.

  22. kptfh commented on Sep 4, 2024

    @kptfh

    released version 4.1.0 with support of SB3.2
    fill free to reopen this ticket in case of any issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions