Skip to content

larry4xie/spring-boot-starter-feign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-starter-feign

dependency

<dependency>
    <groupId>xyz.lxie</groupId>
    <artifactId>spring-boot-starter-feign</artifactId>
    <version>${starter-feign.version}</version>
</dependency>

search newest version

usage

// 1. EnableFeignClients
@SpringBootApplication
@EnableFeignClients
public class Main {
    public static void main(String[] args) {
       SpringApplication.run(Application.class, args);
   }
}

// 2. @FeignClient
// or @FeignClient("https://api.github.com")
@FeignClient("${api.github}")
public interface GitHub {
    @RequestLine("GET /repos/{owner}/{repo}/contributors")
    List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo);

    @Data
    class Contributor {
        String login;
        int contributions;
    }
}
// 3. usage
@Autowired
private GitHub github;

@Test
public void testGithub() {
   github.contributors("xiegang", "spring-boot-starter-feign").forEach(contributor -> {
       System.out.println(contributor.login + " (" + contributor.contributions + ")");
   });
}

See details: FeignAutoConfiguration

About

spring-boot-starter-feign

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages