Skip to content

A module to marry together Feign bound resources to the Guice dependency injection framework

License

Notifications You must be signed in to change notification settings

mlk/feign-guice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov.io

feign-guice

A module to marry together Feign bound resources to the Guice dependency injection framework.

    public static void main(String... arg) {
        Injector injector = Guice.createInjector(FeignModule.builder()
                // Setting the builder here is optional, if not set it will ask Guice for one.
                .withBuilder(Feign.builder().decoder(new GsonDecoder()))
                // The base URL is required.
                .withUrl("https://api.github.com")
                // The packages to scan.
                .scan("com.github.mlk.guice.api").build());

        GitHub github = injector.getInstance(GitHub.class);
        List<Contributor> contributors = github.contributors("netflix", "feign");
        for (Contributor contributor : contributors) {
            System.out.println(contributor.login + " (" + contributor.contributions + ")");
        }

It is on Maven, so use it with:

<dependency>
  <groupId>com.github.mlk</groupId>
  <artifactId>feign-guice</artifactId>
  <version>1.0.0</version>
</dependency>

About

A module to marry together Feign bound resources to the Guice dependency injection framework

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages