<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.M9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
The First Question:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
In the spring cloud Finchley.M9, the annotation of '@feignclient' could not be found.
why need to add the dependency of 'spring-cloud-openfeign-core'?
the second Question: in my project, when dependency other *.jar(the jar is feign project) in error java.lang.ClassNotFoundException: feign.optionals.OptionalDecoder
Comment From: ryanjbaxter
Please open an issue per question. Or better yet ask questions on Gitter or StackOverflow.
Please learn how to format code on GitHub.
1.) spring-cloud-openfeign-core is part of spring-cloud-starter-openfeign so you should not need to add it
https://github.com/spring-cloud/spring-cloud-openfeign/blob/v2.0.0.M2/spring-cloud-starter-openfeign/pom.xml#L28
2.) I dont know what this means
in my project, when dependency other *.jar(the jar is feign project)
Comment From: fengyws
1.)
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-java8</artifactId>
</dependency>
Comment From: ryanjbaxter
1.) There have been some problems with the moving the code and the jar naming in maven repos. Clean you local maven repo and try your build again.
2.) You should not need to include any additional feign jars. sounds like a pom misconfiguration
Comment From: fengyws
thanks,i try
Comment From: keyantec
@ryanjbaxter I have the same problem, 2.0.0.M2 can not find spring-cloud-openfeign-core,you can see the newest pom
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix</artifactId>
<version>2.0.0.M2</version>
</parent>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<name>Spring Cloud Starter OpenFeign</name>
<description>Spring Cloud Starter OpenFeign</description>
<url>https://projects.spring.io/spring-cloud</url>
<organization>
<name>Pivotal Software, Inc.</name>
<url>https://www.spring.io</url>
</organization>
<properties>
<main.basedir>${basedir}/../../..</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-slf4j</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-archaius</artifactId>
</dependency>
</dependencies>
</project>
I include the feign core in this way:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>2.0.0.M2</version>
</dependency>
,there is no problem when compile,bug when I run the program ,has error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.xiaoke.teach.spring.cloud.base.FeignClientTest': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'feignDecoder' defined in org.springframework.cloud.openfeign.FeignClientsConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [feign.codec.Decoder]: Factory method 'feignDecoder' threw exception; nested exception is java.lang.NoClassDefFoundError: feign/optionals/OptionalDecoder
Comment From: keyantec
@ryanjbaxter I see the pom in the github project , bug when you download the jar with maven, it is different, I think that the change is not upload to maven repo.
Comment From: keyantec
@ryanjbaxter
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign-core</artifactId>
<version>2.0.0.M2</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-java8</artifactId>
<version>9.6.0</version>
</dependency>
I need to include three jars that project can run OK.
Comment From: ryanjbaxter
There was a couple problems with old jars in certain repos for M2. Finchley.RC1 was just released try that instead.
Please learn how to format code on GitHub.
Comment From: henzer
Hi @keyantec, there is no need to add feign-java8 library. The OptionalDecoder class was added into feign-core since 10.0.0 version. You should update it