相关文章推荐
率性的山楂  ·  debian开启tun·  1 年前    · 
愉快的沙滩裤  ·  css - ...·  2 年前    · 
痴情的啄木鸟  ·  使用 Preload&Prefetch ...·  2 年前    · 
千年单身的猴子  ·  gradle - Failed to ...·  2 年前    · 

I'm trying to use Feign client. Below is my feing client:

import com.eprogrammerz.examples.domain.Movie;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 * Created by Yogen on 12/26/2016.
@FeignClient(name = "movie-api")
public interface MovieApi {
    @RequestMapping(method = RequestMethod.GET, value = "/movies/{id}")
    Movie getMovie(@PathVariable("id") Long id);

I'm calling it from simple service as below:

@Service
public class MovieService {
    @Autowired
    MovieApi movieApi;
    public Movie findMovie(Long id){
        Movie movieOfTheDay = movieApi.getMovie(id);
        return movieOfTheDay;

My spring boot app is as below:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
@EnableFeignClients(basePackages = {"com.eprogrammerz.examples"})
@EnableCircuitBreaker
@SpringBootApplication
public class ClientAppApplication {
    public static void main(String[] args) {
        SpringApplication.run(ClientAppApplication.class, args);

build.gradle

buildscript