Last active
August 29, 2021 11:39
-
-
Save giner/07a104ff2d16c81df8c8241a5561e7a0 to your computer and use it in GitHub Desktop.
Java, OpenFeign: Minimalistic quick start example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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