我是微服务的新手,只是尝试创建两个微服务并将其注册到eureka。我收到以下异常:
"com.netflix.client.ClientException: Load balancer does not have available server for client: forex-service". Below is my configuration.
eureka命名服务器类:
@SpringBootApplication
@EnableEurekaServer
public class MicroserviceEurekaNamingServerApplication {}
application.properties
spring.application.name=netflix-eureka-naming-server
server.port=8761
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
外汇服务类别:
@SpringBootApplication
@EnableDiscoveryClient
@EnableEurekaClient
public class Forex2Microservice2Application {}
application.properties
spring.application.name=forex-service
spring.jpa.show-sql=true
spring.h2.console.enabled=true
eureka.client.service-url.default-zone=http://localhost:8761/eureka
货币服务类别:
@SpringBootApplication
@EnableFeignClients
@EnableDiscoveryClient
@EnableEurekaClient
public class SpringBootMicroserviceCurrencyConversionApplication {}
application.properties
spring.application.name=currency-conversion-service
server.port=8100
eureka.client.service-url.default-zone=http://localhost:8761/eureka
假冒客户
@FeignClient(name = "forex-service")
@RibbonClient(name = "forex-service")
public interface CurrencyExchangeServiceProxy {}
谢谢。