kandi background
Explore Kits

feign | Feign makes writing java http clients easier | HTTP library

 by   OpenFeign Java Version: 11.8 License: Apache-2.0

 by   OpenFeign Java Version: 11.8 License: Apache-2.0

Download this library from

kandi X-RAY | feign Summary

feign is a Java library typically used in Networking, HTTP applications. feign has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub.
This is a map with current key features provided by feign:.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • feign has a highly active ecosystem.
  • It has 7978 star(s) with 1655 fork(s). There are 421 watchers for this library.
  • There were 2 major release(s) in the last 12 months.
  • There are 126 open issues and 694 have been closed. On average issues are closed in 203 days. There are 18 open pull requests and 0 closed requests.
  • It has a positive sentiment in the developer community.
  • The latest version of feign is 11.8
feign Support
Best in #HTTP
Average in #HTTP
feign Support
Best in #HTTP
Average in #HTTP

quality kandi Quality

  • feign has 0 bugs and 0 code smells.
feign Quality
Best in #HTTP
Average in #HTTP
feign Quality
Best in #HTTP
Average in #HTTP

securitySecurity

  • feign has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • feign code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
feign Security
Best in #HTTP
Average in #HTTP
feign Security
Best in #HTTP
Average in #HTTP

license License

  • feign is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
feign License
Best in #HTTP
Average in #HTTP
feign License
Best in #HTTP
Average in #HTTP

buildReuse

  • feign releases are available to install and integrate.
  • Build file is available. You can build the component from source.
  • Installation instructions are not available. Examples and code snippets are available.
  • feign saves you 14126 person hours of effort in developing the same functionality from scratch.
  • It has 33565 lines of code, 3124 functions and 333 files.
  • It has low code complexity. Code complexity directly impacts maintainability of the code.
feign Reuse
Best in #HTTP
Average in #HTTP
feign Reuse
Best in #HTTP
Average in #HTTP
Top functions reviewed by kandi - BETA

kandi has reviewed feign and discovered the below as its top functions. This is intended to give you an instant insight into feign implemented functionality, and help decide if they suit your requirements.

  • Resolve the template .
  • Creates a HTTP request for the given request .
  • Handles a response .
  • Checks if two types are equals .
  • Convert ResponseBody to Body .
  • Executes the given template and returns the result .
  • Reads a JSON document and returns the results .
  • Stage decoded response .
  • Invokes a method with the given arguments .
  • Convert a request into an HttpRequest .

feign Key Features

Feign 10.x and above are built on Java 8 and should work on Java 9, 10, and 11. For those that need JDK 6 compatibility, please use Feign 9.x.

Basics

copy iconCopydownload iconDownload
interface GitHub {
  @RequestLine("GET /repos/{owner}/{repo}/contributors")
  List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo);

  @RequestLine("POST /repos/{owner}/{repo}/issues")
  void createIssue(Issue issue, @Param("owner") String owner, @Param("repo") String repo);

}

public static class Contributor {
  String login;
  int contributions;
}

public static class Issue {
  String title;
  String body;
  List<String> assignees;
  int milestone;
  List<String> labels;
}

public class MyApp {
  public static void main(String... args) {
    GitHub github = Feign.builder()
                         .decoder(new GsonDecoder())
                         .target(GitHub.class, "https://api.github.com");

    // Fetch and print a list of the contributors to this library.
    List<Contributor> contributors = github.contributors("OpenFeign", "feign");
    for (Contributor contributor : contributors) {
      System.out.println(contributor.login + " (" + contributor.contributions + ")");
    }
  }
}

Interface Annotations

copy iconCopydownload iconDownload
@RequestLine("POST /repos/{owner}/{repo}/issues")
void createIssue(URI host, Issue issue, @Param("owner") String owner, @Param("repo") String repo);

Templates and Expressions

copy iconCopydownload iconDownload
public interface GitHub {

  @RequestLine("GET /repos/{owner}/{repo}/contributors")
  List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repository);

  class Contributor {
    String login;
    int contributions;
  }
}

public class MyApp {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                         .decoder(new GsonDecoder())
                         .target(GitHub.class, "https://api.github.com");

    /* The owner and repository parameters will be used to expand the owner and repo expressions
     * defined in the RequestLine.
     *
     * the resulting uri will be https://api.github.com/repos/OpenFeign/feign/contributors
     */
    github.contributors("OpenFeign", "feign");
  }
}

Customization

copy iconCopydownload iconDownload
interface Bank {
  @RequestLine("POST /account/{id}")
  Account getAccountInfo(@Param("id") String id);
}

public class BankService {
  public static void main(String[] args) {
    Bank bank = Feign.builder()
        .decoder(new AccountDecoder())
        .options(new Request.Options(10, TimeUnit.SECONDS, 60, TimeUnit.SECONDS, true))
        .target(Bank.class, "https://api.examplebank.com");
  }
}

Multiple Interfaces

copy iconCopydownload iconDownload
public class CloudService {
  public static void main(String[] args) {
    CloudDNS cloudDNS = Feign.builder()
      .target(new CloudIdentityTarget<CloudDNS>(user, apiKey));
  }

  class CloudIdentityTarget extends Target<CloudDNS> {
    /* implementation of a Target */
  }
}

Gson

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    GsonCodec codec = new GsonCodec();
    GitHub github = Feign.builder()
                         .encoder(new GsonEncoder())
                         .decoder(new GsonDecoder())
                         .target(GitHub.class, "https://api.github.com");
  }
}

Jackson

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
      GitHub github = Feign.builder()
                     .encoder(new JacksonEncoder())
                     .decoder(new JacksonDecoder())
                     .target(GitHub.class, "https://api.github.com");
  }
}

Sax

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
      Api api = Feign.builder()
         .decoder(SAXDecoder.builder()
                            .registerContentHandler(UserIdHandler.class)
                            .build())
         .target(Api.class, "https://apihost");
    }
}

JAXB

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    Api api = Feign.builder()
             .encoder(new JAXBEncoder())
             .decoder(new JAXBDecoder())
             .target(Api.class, "https://apihost");
  }
}

JAX-RS

copy iconCopydownload iconDownload
interface GitHub {
  @GET @Path("/repos/{owner}/{repo}/contributors")
  List<Contributor> contributors(@PathParam("owner") String owner, @PathParam("repo") String repo);
}

public class Example {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                       .contract(new JAXRSContract())
                       .target(GitHub.class, "https://api.github.com");
  }
}

OkHttp

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                     .client(new OkHttpClient())
                     .target(GitHub.class, "https://api.github.com");
  }
}

Ribbon

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    MyService api = Feign.builder()
          .client(RibbonClient.create())
          .target(MyService.class, "https://myAppProd");
  }
}

Java 11 Http2

copy iconCopydownload iconDownload
GitHub github = Feign.builder()
                     .client(new Http2Client())
                     .target(GitHub.class, "https://api.github.com");

Hystrix

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    MyService api = HystrixFeign.builder().target(MyService.class, "https://myAppProd");
  }
}

SOAP

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    Api api = Feign.builder()
	     .encoder(new SOAPEncoder(jaxbFactory))
	     .decoder(new SOAPDecoder(jaxbFactory))
	     .errorDecoder(new SOAPErrorDecoder())
	     .target(MyApi.class, "http://api");
  }
}

SLF4J

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                     .logger(new Slf4jLogger())
                     .logLevel(Level.FULL)
                     .target(GitHub.class, "https://api.github.com");
  }
}

Decoders

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                     .decoder(new GsonDecoder())
                     .target(GitHub.class, "https://api.github.com");
  }
}

Encoders

copy iconCopydownload iconDownload
interface LoginClient {
  @RequestLine("POST /")
  @Headers("Content-Type: application/json")
  void login(String content);
}

public class Example {
  public static void main(String[] args) {
    client.login("{\"user_name\": \"denominator\", \"password\": \"secret\"}");
  }
}

@Body templates

copy iconCopydownload iconDownload
interface LoginClient {

  @RequestLine("POST /")
  @Headers("Content-Type: application/xml")
  @Body("<login \"user_name\"=\"{user_name}\" \"password\"=\"{password}\"/>")
  void xml(@Param("user_name") String user, @Param("password") String password);

  @RequestLine("POST /")
  @Headers("Content-Type: application/json")
  // json curly braces must be escaped!
  @Body("%7B\"user_name\": \"{user_name}\", \"password\": \"{password}\"%7D")
  void json(@Param("user_name") String user, @Param("password") String password);
}

public class Example {
  public static void main(String[] args) {
    client.xml("denominator", "secret"); // <login "user_name"="denominator" "password"="secret"/>
    client.json("denominator", "secret"); // {"user_name": "denominator", "password": "secret"}
  }
}

Headers

copy iconCopydownload iconDownload
@Headers("Accept: application/json")
interface BaseApi<V> {
  @Headers("Content-Type: application/json")
  @RequestLine("PUT /api/{key}")
  void put(@Param("key") String key, V value);
}

Advanced usage

copy iconCopydownload iconDownload
interface BaseAPI {
  @RequestLine("GET /health")
  String health();

  @RequestLine("GET /all")
  List<Entity> all();
}

Error Handling

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    MyApi myApi = Feign.builder()
                 .errorDecoder(new MyErrorDecoder())
                 .target(MyApi.class, "https://api.hostname.com");
  }
}

Retry

copy iconCopydownload iconDownload
public class Example {
  public static void main(String[] args) {
    MyApi myApi = Feign.builder()
                 .retryer(new MyRetryer())
                 .target(MyApi.class, "https://api.hostname.com");
  }
}

Metrics

copy iconCopydownload iconDownload
public class MyApp {
  public static void main(String[] args) {
    GitHub github = Feign.builder()
                         .addCapability(new Metrics4Capability())
                         .target(GitHub.class, "https://api.github.com");

    github.contributors("OpenFeign", "feign");
    // metrics will be available from this point onwards
  }
}

Async execution via

copy iconCopydownload iconDownload
interface GitHub {
  @RequestLine("GET /repos/{owner}/{repo}/contributors")
  CompletableFuture<List<Contributor>> contributors(@Param("owner") String owner, @Param("repo") String repo);
}

public class MyApp {
  public static void main(String... args) {
    GitHub github = AsyncFeign.asyncBuilder()
                         .decoder(new GsonDecoder())
                         .target(GitHub.class, "https://api.github.com");

    // Fetch and print a list of the contributors to this library.
    CompletableFuture<List<Contributor>> contributors = github.contributors("OpenFeign", "feign");
    for (Contributor contributor : contributors.get(1, TimeUnit.SECONDS)) {
      System.out.println(contributor.login + " (" + contributor.contributions + ")");
    }
  }
}

Feign Client being ignored during component scan

copy iconCopydownload iconDownload
@SpringBootApplication
@EnableFeignClients
public class ExampleApplication {

    public static void main(String[] args) {
        SpringApplication.run(ExampleApplication.class, args);
    }
}

Spring Boot WebClient stops sending requests

copy iconCopydownload iconDownload
jstack <java pid> > ThredDump.txt
-----------------------
    "reactor-http-epoll-6@15467" daemon prio=5 tid=0xbe nid=NA waiting
  java.lang.Thread.State: WAITING
      at jdk.internal.misc.Unsafe.park(Unsafe.java:-1)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
      at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1796)

No converter found capable of converting from type [com.google.protobuf.ByteString$LiteralByteString] to type [java.lang.String]

copy iconCopydownload iconDownload
class GcpStringGenericConverter : GenericConverter {

    override fun getConvertibleTypes(): MutableSet<GenericConverter.ConvertiblePair> {
        return mutableSetOf(GenericConverter.ConvertiblePair(ByteString::class.java, String::class.java))
    }

    override fun convert(source: Any?, sourceType: TypeDescriptor, targetType: TypeDescriptor): Any? {
        return (source as? ByteString)?.toString(UTF_8)
    }

}
fun main(args: Array<String>) {
    (DefaultConversionService.getSharedInstance() as? DefaultConversionService)?.addConverter(GcpStringGenericConverter())
    runApplication<MyApplication>(*args)
}
-----------------------
class GcpStringGenericConverter : GenericConverter {

    override fun getConvertibleTypes(): MutableSet<GenericConverter.ConvertiblePair> {
        return mutableSetOf(GenericConverter.ConvertiblePair(ByteString::class.java, String::class.java))
    }

    override fun convert(source: Any?, sourceType: TypeDescriptor, targetType: TypeDescriptor): Any? {
        return (source as? ByteString)?.toString(UTF_8)
    }

}
fun main(args: Array<String>) {
    (DefaultConversionService.getSharedInstance() as? DefaultConversionService)?.addConverter(GcpStringGenericConverter())
    runApplication<MyApplication>(*args)
}

how to try...catch a feign exception and return only the status code and the erro message

copy iconCopydownload iconDownload
} catch (FeignException e) {

reactive feign client global retry

copy iconCopydownload iconDownload
@Bean
public ReactiveRetryPolicy reactiveRetryPolicy() {
    return BasicReactiveRetryPolicy.retryWithBackoff(5, 100);
}

failing to add client credentials (clientid/clientsecret) at Spring Webclient: Request processing failed ... 401 UNAUTHORIZED

copy iconCopydownload iconDownload
webClient
        .post()
        .uri(UriComponentsBuilder
            .fromHttpUrl("https://mycomp.url")
            .path("/api/oauth/token")
            .build()
            .toUri())
        .body(BodyInserters.fromFormData("grant_type", "client_credentials")
                           .with("client_id", "xxx")
                           .with("client_secret", "yyy")) 
        .header(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded") 
        .retrieve()
        // ...
        
-----------------------
fun postAsynchronous(): Mono<TokenResponse> = webClient
    .post()
    .uri(UriComponentsBuilder
        .fromHttpUrl("https://des-sts-int.mbi.cloud.ihf")
        .path("/api/oauth/token")
        .build()
        .toUri())
    .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    .body(BodyInserters.fromFormData("grant_type", "client_credentials")
                           .with("client_id", "xxx")
                           .with("client_secret", "yyy")) )
    .retrieve()
    .onStatus(HttpStatus::is4xxClientError) { Mono.error(RuntimeException("4XX Error ${it.statusCode()}")) }
    .onStatus(HttpStatus::is5xxServerError) { Mono.error(RuntimeException("5XX Error ${it.statusCode()}")) }
    .bodyToMono(TokenResponse::class.java)

java.lang.NoClassDefFoundError: org/junit/platform/commons/util/ClassNamePatternFilterUtils when trying run mockito junit5 test with gradle

copy iconCopydownload iconDownload
testRuntimeOnly 'org.junit.platform:junit-platform-commons:1.7.1'

java.lang.NoSuchFieldError: INSTANCE at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.initializeCommon

copy iconCopydownload iconDownload
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>
-----------------------
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>
-----------------------
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>
-----------------------
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>
-----------------------
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>
-----------------------
[INFO] +- com.acme.apollo.idm:idm-neo:jar:3.0.0-SCMOD-14133-SNAPSHOT:compile
[INFO] |  +- org.keycloak:keycloak-admin-client:jar:14.0.0:compile
[INFO] |  |  +- org.jboss.resteasy:resteasy-multipart-provider:jar:3.13.2.Final:compile
[INFO] |  |  |  +- org.jboss.resteasy:resteasy-jaxrs:jar:3.13.2.Final:compile
[INFO] |  |  |  +- com.sun.mail:jakarta.mail:jar:1.6.5:compile
[INFO] |  |  |  \- org.apache.james:apache-mime4j:jar:0.6:compile
[INFO] |  |  \- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.13.2.Final:compile
[INFO] |  |     \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3-b02:compile
[INFO] |  |        +- org.glassfish.jaxb:txw2:jar:2.3.3-b02:compile
[INFO] |  |        \- com.sun.istack:istack-commons-runtime:jar:3.0.10:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-client-api:jar:4.6.0.Final:compile
[INFO] |  +- org.jboss.resteasy:resteasy-core:jar:4.6.0.Final:compile
<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
</dependency>
      if (parent == null) {
         // parent should always have these delegates
         addHeaderDelegateIfAbsent(MediaType.class, MediaTypeHeaderDelegate.INSTANCE);
         addHeaderDelegateIfAbsent(NewCookie.class, NewCookieHeaderDelegate.INSTANCE);
public class MediaTypeHeaderDelegate implements RuntimeDelegate.HeaderDelegate<MediaType>
{
   public static final MediaTypeHeaderDelegate INSTANCE = new MediaTypeHeaderDelegate();

<dependency>
    <groupId>com.acme.apollo.idm</groupId>
    <artifactId>idm-neo</artifactId>
    <version>3.0.0-SCMOD-14133-SNAPSHOT</version>
    <exclusions>
        <exclusion>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.keycloak</groupId>
    <artifactId>keycloak-admin-client</artifactId>
    <version>14.0.0</version>
    <exclusions>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-multipart-provider</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-multipart-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jaxb-provider</artifactId>
    <version>4.6.0.Final</version>
</dependency>
<dependencyManagement>
    <dependency> 
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-multipart-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>4.6.0.Final</version>
    </dependency>
</dependencyManagement>

Can't set Typography in Jetpack Compose

copy iconCopydownload iconDownload
ext {
    compose_version = '1.0.0-beta09'
}

Jhipster Spring Boot 2 instances of a microservice on different databases

copy iconCopydownload iconDownload
java -Dspring.profiles.active=dev -Dserver.port=7040 -jar microservice-0.0.1-SNAPSHOT.jar -Dspring-boot.run.arguments= --hazelcast.port=12741 --APP_INSTANCE_NAME=microservice --APP_NAME=Microservice --APP_CLIENT_NAME='MicroserviceApp' --mainflux.broker=10.172.192.26 --APP_SWAGGER_TITLE='Microservice API' --APP_SWAGGER_DESC='Microservice API documentation'
    eureka:
      client:
        enabled: true
        healthcheck:
          enabled: true
        fetch-registry: true
        register-with-eureka: true
        instance-info-replication-interval-seconds: 10
        registry-fetch-interval-seconds: 10
      instance:
        appname: ${APP_INSTANCE_NAME:microservice}
        instanceId: ${APP_INSTANCE_NAME:microservice}:${spring.application.instance-id:${random.value}}
        lease-renewal-interval-in-seconds: 5
        lease-expiration-duration-in-seconds: 10
        status-page-url-path: ${management.endpoints.web.base-path}/info
        health-check-url-path: ${management.endpoints.web.base-path}/health
        metadata-map:
          zone: primary # This is needed for the load balancer
          profile: ${spring.profiles.active}
          version: #project.version#
          git-version: ${git.commit.id.describe:}
          git-commit: ${git.commit.id.abbrev:}
          git-branch: ${git.branch:}
...
...
...
-----------------------
java -Dspring.profiles.active=dev -Dserver.port=7040 -jar microservice-0.0.1-SNAPSHOT.jar -Dspring-boot.run.arguments= --hazelcast.port=12741 --APP_INSTANCE_NAME=microservice --APP_NAME=Microservice --APP_CLIENT_NAME='MicroserviceApp' --mainflux.broker=10.172.192.26 --APP_SWAGGER_TITLE='Microservice API' --APP_SWAGGER_DESC='Microservice API documentation'
    eureka:
      client:
        enabled: true
        healthcheck:
          enabled: true
        fetch-registry: true
        register-with-eureka: true
        instance-info-replication-interval-seconds: 10
        registry-fetch-interval-seconds: 10
      instance:
        appname: ${APP_INSTANCE_NAME:microservice}
        instanceId: ${APP_INSTANCE_NAME:microservice}:${spring.application.instance-id:${random.value}}
        lease-renewal-interval-in-seconds: 5
        lease-expiration-duration-in-seconds: 10
        status-page-url-path: ${management.endpoints.web.base-path}/info
        health-check-url-path: ${management.endpoints.web.base-path}/health
        metadata-map:
          zone: primary # This is needed for the load balancer
          profile: ${spring.profiles.active}
          version: #project.version#
          git-version: ${git.commit.id.describe:}
          git-commit: ${git.commit.id.abbrev:}
          git-branch: ${git.branch:}
...
...
...

Community Discussions

Trending Discussions on feign
  • Can one setup Spring Boot 2.6 and Spring Cloud 2021.x to use Ribbon and Hystrix with Spring WebClient and Feign?
  • Feign Client being ignored during component scan
  • Spring Boot WebClient stops sending requests
  • FeignClient logs printing two configured Interceptor called, this is confusion to identify which one is actual at runtime
  • No converter found capable of converting from type [com.google.protobuf.ByteString$LiteralByteString] to type [java.lang.String]
  • how to try...catch a feign exception and return only the status code and the erro message
  • reactive feign client global retry
  • failing to add client credentials (clientid/clientsecret) at Spring Webclient: Request processing failed ... 401 UNAUTHORIZED
  • AWS Java Lambda not connecting to Internet - no VPC
  • Feign - Hystrix - feign.RetryableException: Connection refused: no further information executing GET
Trending Discussions on feign

QUESTION

Can one setup Spring Boot 2.6 and Spring Cloud 2021.x to use Ribbon and Hystrix with Spring WebClient and Feign?

Asked 2022-Apr-12 at 10:13

I know that Spring Cloud at some version (3.0?) dropped direct support for some Netflix libraries like Ribbon or Hystrix. Now I'm trying to make a smooth migration of around 20 microservices running on production having some custom code extending Ribbon (and Hystrix to a lesser degree). The main goal is to upgrade from Spring Boot 2.3 to 2.6. As a consequence I need to upgrade Spring Cloud to 3.1.x, right?

My guess was to proceed with 2-step upgrade to avoid a one big-step migration:

  1. Upgrade to Spring Boot 2.6 and Spring Cloud 3.1 while still using Ribbon and Hystrix
  2. Make a way through a jungle of an old code and getting rid of Ribbon and Hystrix in smaller increments.

However to achieve this I'm trying to use simultanously Spring Boot 2.6, Spring Cloud with release train 2021.01 and 2 selected starters from older Spring Cloud (latest versions of these artifacts):

  • spring-cloud-starter-netflix-hystrix 2.2.10.RELEASE
  • spring-cloud-starter-netflix-ribbon 2.2.10.RELEASE

Is this possible at all? We are heavilly using Feign and Spring WebClient - client-side load-balancing must work for these. So far I found out Feign clients are not automatically integrated with Ribbon.

@spencergibb @OlgaMaciaszek - especially counting on you.

ANSWER

Answered 2022-Apr-12 at 10:13

Answering my own question after receiving confirmation from Spring Cloud team by other means: this is a bad idea to try use Ribbon with Spring Cloud 2021.01 and it would require a really hard work to make it working.

Source https://stackoverflow.com/questions/71794854

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install feign

You can download it from GitHub.
You can use feign like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the feign component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Compare HTTP Libraries with Highest Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.