Skip to content

Instantly share code, notes, and snippets.

@giner
Last active August 29, 2021 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giner/07a104ff2d16c81df8c8241a5561e7a0 to your computer and use it in GitHub Desktop.
Save giner/07a104ff2d16c81df8c8241a5561e7a0 to your computer and use it in GitHub Desktop.
Java, OpenFeign: Minimalistic quick start example
// Usage:
// curl -L -O https://repo1.maven.org/maven2/io/github/openfeign/feign-core/11.6/feign-core-11.6.jar
// java -cp feign-core-11.6.jar HelloFeign.java
import feign.Feign;
import feign.RequestLine;
public class MyFeignClient {
private static final String uriPrefix = "https://github.com";
public static void main(String... args) {
MyClient myClient = Feign.builder()
.target(MyClient.class, uriPrefix);
String response = myClient.getOpenFeign();
System.out.println(response);
}
interface MyClient {
@RequestLine("GET /OpenFeign/feign")
String getOpenFeign();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment