我正在尝试从Ribbon迁移Client Load balancer,并有以下配置。
id 'org.springframework.boot' version '2.4.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
'springCloudVersion', "2020.0.2"
application.properties (library-service)
user-service.ribbon.listOfServers=http://localhost:9091
UserServiceProxy.java
@FeignClient(name="user-service")
@LoadBalancerClient(name="user-service")
interface UserServiceProxy{}
ApplicationClass.java
@EnableFeignClients(basePackages = "com.library.service")
public class LibraryServiceApplication {}
我不明白为什么我在尝试使用代理访问用户服务时,会出现以下错误。有人能帮助我吗?
There was an unexpected error (type=Internal Server Error, status=500). [503] during [GET] to [http://user-service/users/10] [UserServiceProxy#getUserById(Long)]: [Load balancer does not contain an instance for the service user-service]
是否可以在没有Eureka服务器的情况下使用客户端LoadBalancer?因为我们在早期版本中使用了Ribbon和feign。