feignclient实现服务之间调用

服务A需调用服务B的test方法

B服务不动

A:

最好新建一个server

@Component
@FeignClient(value = "tools")
public interface ServiceAFeignClient {
	
	@RequestMapping(value = "/hi")
    String test();
}

tools为服务B配置中的spring.application.name,  hi为B中Controller的接口

然后A中代码调用新建的server的接口即可,可能会出错com.netflix.client.ClientException: Load balancer does not have available server for client

A的application配置加

ribbon:
  eureka:
    enabled: true

你可能感兴趣的:(bug处理,学习)