Open Feign CDI Parent

CDI Integration for OpenFeign

License

License

Categories

Categories

Feign Net HTTP Clients
GroupId

GroupId

io.github.openfeign.cdi
ArtifactId

ArtifactId

parent
Last Version

Last Version

0.1.6
Release Date

Release Date

Type

Type

pom
Description

Description

Open Feign CDI Parent
CDI Integration for OpenFeign
Project URL

Project URL

https://github.com/OpenFeign/feign-cdi
Source Code Management

Source Code Management

https://github.com/OpenFeign/feign-cdi

Download parent

Filename Size
parent-0.1.6.pom 8 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.openfeign.cdi/parent/ -->
<dependency>
    <groupId>io.github.openfeign.cdi</groupId>
    <artifactId>parent</artifactId>
    <version>0.1.6</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/io.github.openfeign.cdi/parent/
implementation 'io.github.openfeign.cdi:parent:0.1.6'
// https://jarcasting.com/artifacts/io.github.openfeign.cdi/parent/
implementation ("io.github.openfeign.cdi:parent:0.1.6")
'io.github.openfeign.cdi:parent:pom:0.1.6'
<dependency org="io.github.openfeign.cdi" name="parent" rev="0.1.6">
  <artifact name="parent" type="pom" />
</dependency>
@Grapes(
@Grab(group='io.github.openfeign.cdi', module='parent', version='0.1.6')
)
libraryDependencies += "io.github.openfeign.cdi" % "parent" % "0.1.6"
[io.github.openfeign.cdi/parent "0.1.6"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • feign-cdi

Feign CDI

Integration for OpenFeign with Java Contexts & Dependency Injection, allowing you to inject your type safe restful interfaces

Adding to your project

Feign CDI is built using Apache Maven. Artifacts are published, though there's only a single artifact at this time.

<dependency>
    <groupId>io.github.openfeign.cdi</groupId>
    <artifactId>feign-cdi</artifactId>
    <version>0.1.6</version>
</dependency>

Creating clients

Feign CDI uses the normal Feign interfaces for declaring your rest client. You can add additional annotations to your interface to support CDI integration

@FeignClient

public @interface FeignClient {
    Logger.Level logLevel() default Logger.Level.NONE;

    Class<? extends Contract> contract() default Contract.Default.class;

    Class<? extends Client> client() default CDIClient.class;

    Class<? extends Decoder> decoder() default Decoder.Default.class;

    Class<? extends Encoder> encoder() default Encoder.Default.class;

    Class<? extends ErrorDecoder> errorDecoder() default ErrorDecoder.Default.class;

    Class<? extends InvocationHandlerFactory> invocationHandlerFactory() default InvocationHandlerFactory.Default.class;

    Class<? extends Logger> logger() default Logger.NoOpLogger.class;

    Class<? extends Retryer> retryer() default Retryer.Default.class;

    Class<? extends RequestInterceptor>[] requestInterceptors() default {};

    String url();

    int connectTimeoutMillis() default 10 * 1000;

    int readTimeoutMillis() default 60 * 1000;

    boolean decode404() default false;
}

@FeignClient is an annotation to place on your interfaces where you can define the normal configuration options for Feign interfaces. The defaults here match the defaults in Feign.Builder, except for the client implementation to support no-arg constructors.

Any class configured here will follow one of two options:

  • Managed CDI Beans
  • No-args constructor

Any classes you use here should be normal scoped beans - don't use @Dependent as there is no creational context. If no bean is found, then this extension will instantiate the class using its default constructor.

Managing Scopes

Any @Scope declared on the interface will be used by the bean.

Registering the extension

The CDI extension class to register is feign.cdi.impl.FeignExtension, which will add annotated client beans for each interface discovered.

io.github.openfeign.cdi

Versions

Version
0.1.6
0.1.5