PlaytikaOSS / feign-reactive

Reactive Feign client inspired by https://github.com/OpenFeign project
Apache License 2.0
616 stars 125 forks source link

What versions do SpringBoot, Springcloud and feign-reactive support? #156

Closed SnowZhouJ closed 4 years ago

SnowZhouJ commented 4 years ago

In my project,2.2.1 Springboot , Hoxton.RC1 SpringCloud, 1.0.41 reactivefeign,But it doesn't start。 error: Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration I tried all 2.2.x versions, none of which started. Why? I tried 2.1.2 springboot, 1.0.22 reactivefeign, Greenwich SpringCloud is available.

kptfh commented 4 years ago

Here is the reactive feign sample project that I'v just updated to latest feign and Hoxton reactive feign sample. It starts and works well. I'd like you to provide full stack trace of your error. And the best option is the reproducible test (you can create it in your fork of the sample project)

SnowZhouJ commented 4 years ago

@kptfh Thanks. I used the Feign sample project from reactive feign sample. . I think it might be a jar version compatibility issue. `2019-12-17 09:43:18.856 WARN 59124 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [reactivefeign.spring.config.ReactiveFeignClientsConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration 2019-12-17 09:43:18.864 WARN 59124 --- [ main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'feignReactiveApplication': Unsatisfied dependency expressed through field 'reactiveFeignClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.demo.GreetingReactive': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [reactivefeign.spring.config.ReactiveFeignClientsConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration 2019-12-17 09:43:18.925 INFO 59124 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2019-12-17 09:43:18.952 ERROR 59124 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'feignReactiveApplication': Unsatisfied dependency expressed through field 'reactiveFeignClient'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.demo.GreetingReactive': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [reactivefeign.spring.config.ReactiveFeignClientsConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:397) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE] at com.example.demo.FeignReactiveApplication.main(FeignReactiveApplication.java:40) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.example.demo.GreetingReactive': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [reactivefeign.spring.config.ReactiveFeignClientsConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1818) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1266) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:260) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1510) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1467) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1250) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:636) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] ... 19 common frames omitted Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [reactivefeign.spring.config.ReactiveFeignClientsConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:325) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.cloud.context.named.NamedContextFactory.createContext(NamedContextFactory.java:136) ~[spring-cloud-context-2.2.0.RC1.jar:2.2.0.RC1] at org.springframework.cloud.context.named.NamedContextFactory.getContext(NamedContextFactory.java:101) ~[spring-cloud-context-2.2.0.RC1.jar:2.2.0.RC1] at org.springframework.cloud.context.named.NamedContextFactory.getInstance(NamedContextFactory.java:145) ~[spring-cloud-context-2.2.0.RC1.jar:2.2.0.RC1] at reactivefeign.spring.config.ReactiveFeignClientFactoryBean.get(ReactiveFeignClientFactoryBean.java:239) ~[feign-reactor-spring-configuration-1.0.41.jar:na] at reactivefeign.spring.config.ReactiveFeignClientFactoryBean.reactiveFeign(ReactiveFeignClientFactoryBean.java:84) ~[feign-reactor-spring-configuration-1.0.41.jar:na] at reactivefeign.spring.config.ReactiveFeignClientFactoryBean.getTarget(ReactiveFeignClientFactoryBean.java:273) ~[feign-reactor-spring-configuration-1.0.41.jar:na] at reactivefeign.spring.config.ReactiveFeignClientFactoryBean.getObject(ReactiveFeignClientFactoryBean.java:264) ~[feign-reactor-spring-configuration-1.0.41.jar:na] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:171) ~[spring-beans-5.2.1.RELEASE.jar:5.2.1.RELEASE] ... 30 common frames omitted Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class reactivefeign.spring.config.ReactiveFeignClientsConfiguration at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:165) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:395) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:320) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170) ~[spring-context-5.2.1.RELEASE.jar:5.2.1.RELEASE] ... 44 common frames omitted Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_91] at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_91] at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_91] at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_91] at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_91] at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_91] at java.lang.reflect.Executable.declaredAnnotations(Executable.java:599) ~[na:1.8.0_91] at java.lang.reflect.Executable.declaredAnnotations(Executable.java:597) ~[na:1.8.0_91] at java.lang.reflect.Executable.getDeclaredAnnotations(Executable.java:588) ~[na:1.8.0_91] at java.lang.reflect.Method.getDeclaredAnnotations(Method.java:630) ~[na:1.8.0_91] at java.lang.reflect.AccessibleObject.getAnnotations(AccessibleObject.java:207) ~[na:1.8.0_91] at org.springframework.core.type.StandardAnnotationMetadata.isAnnotatedMethod(StandardAnnotationMetadata.java:172) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:156) ~[spring-core-5.2.1.RELEASE.jar:5.2.1.RELEASE] ... 49 common frames omitted`

SnowZhouJ commented 4 years ago

@kptfh This's my pom.xml. Please help me to see if the file configuration is ok `<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.1.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<groupId>com.example</groupId>
<artifactId>feign-reactive</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>feign-reactive</name>
<description>Demo project for Spring Boot</description>

<properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Hoxton.RC1</spring-cloud.version>
    <feign-reactor.version>1.0.41</feign-reactor.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>com.playtika.reactivefeign</groupId>
        <artifactId>feign-reactor-webclient</artifactId>
        <version>${feign-reactor.version}</version>
    </dependency>

    <dependency>
        <groupId>com.playtika.reactivefeign</groupId>
        <artifactId>feign-reactor-cloud</artifactId>
        <version>${feign-reactor.version}</version>
    </dependency>

    <dependency>
        <groupId>com.playtika.reactivefeign</groupId>
        <artifactId>feign-reactor-spring-configuration</artifactId>
        <version>${feign-reactor.version}</version>
    </dependency>

    <dependency>
        <groupId>com.netflix.feign</groupId>
        <artifactId>feign-slf4j</artifactId>
        <version>8.18.0</version>
    </dependency>

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>fastjson</artifactId>
        <version>1.2.57</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.10.1</version>
    </dependency>

</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

`

kptfh commented 4 years ago

what is the Java version? seems that now auto-configuration of Reactive Feign is compatible with java 11 only

SnowZhouJ commented 4 years ago

@kptfh I'm using java 8 .

SnowZhouJ commented 4 years ago

Is it compatible with java8?

kptfh commented 4 years ago

fixed try 1.0.44 with java 8

SnowZhouJ commented 4 years ago

@kptfh Thanks, After the update, the project can run normally. I have another question, how to forward the header? Could you provide a sample? @Headers is invalid.

kptfh commented 4 years ago

check this pass header