load balancer does not have available server for client: provider

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 {
    ext { springBootVersion = '1.4.3.RELEASE' } repositories { jcenter() mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") } } apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'org.springframework.boot' jar { baseName = 'client-app' version = '0.0.1-SNAPSHOT' } sourceCompatibility = 1.8 targetCompatibility = 1.8 repositories { jcenter() mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { compile('org.springframework.cloud:spring-cloud-starter-feign') // https://mvnrepository.com/artifact/com.netflix.hystrix/hystrix-core compile('org.springframework.cloud:spring-cloud-starter-hystrix') compile("org.springframework.boot:spring-boot-starter-web"){ exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging' } compileOnly('org.projectlombok:lombok') testCompile('org.springframework.boot:spring-boot-starter-test') } dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:Camden.BUILD-SNAPSHOT" mavenBom "org.springframework.boot:spring-boot-starter-parent:${springBootVersion}" } }

I'm getting error as below:

2016-12-30 13:07:16.894 INFO 6748 --- [nio-8082-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 39 ms 2016-12-30 13:07:16.939 INFO 6748 --- [nio-8082-exec-1] c.e.e.controllers.RequestController : Calling findMovie(1203) 2016-12-30 13:07:17.240 INFO 6748 --- [rix-movie-api-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@547496c2: startup date [Fri Dec 30 13:07:17 EST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@542e560f 2016-12-30 13:07:17.318 INFO 6748 --- [rix-movie-api-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2016-12-30 13:07:17.619 INFO 6748 --- [rix-movie-api-1] c.netflix.config.ChainedDynamicProperty : Flipping 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

微笑点燃希望

你的鼓励是我创作最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值