我正在微服务体系结构中使用Spring Cloud。.我有eureka作为发现服务器,zuul是网关和其他客户端微服务。
我的问题是,当我提交请求时,zuul会抛出此异常:负载均衡器没有可供客户端使用的服务器。
我确实在网关和其他客户端微服务上添加了 @EnableEurekaClient 批注..并且它们在eureka仪表板中可见。
我尝试将功能区依赖项添加到客户端微服务,但问题仍未解决。
我被困了3天,还没有找到任何解决方案,有人可以帮我吗?
这是我的客户微服务。
@EnableEurekaClient
@SpringBootApplication
class AccountApp
fun main(args : Array<String>)
{
runApplication<AccountApp>(*args)
}
及其application.properties文件
server.port=9300
spring.application.name=accounts-service
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
#eureka.client.fetch-registry=true
这是我的网关
@EnableZuulProxy
@EnableEurekaClient
@SpringBootApplication
class GatewayApp
fun main(args : Array<String>)
{
runApplication<GatewayApp>(*args)
}
及其application.properties文件
server.port=8080
spring.application.name=gateway-server
eureka.client.service-url.defaultZone=http://localhost:8761/eureka
#eureka.client.fetch-registry=true
zuul.routes.accounts-service.id=accounts-service
zuul.routes.accounts-service.path=/a/**
我尝试了几种在互联网上找到的解决方案,但是没有用