@FeignClient
에 사용할 서버 목록을 구성 할 수 없습니다. Spring Cloud Netflix를 사용하고 있지만이 특정 서비스 (foo-service
)는 Eureka에 등록하지 않습니다. 이러한 이유로 YML 파일에 foo-service
에 대한 서버 목록을 구성해야합니다.@FeignClient를 서버 목록으로 구성 할 수 없습니다.
그러나 listOfServers
은 읽히지 않으므로 Feign/Ribbon에 사용할 단일 서버가 없으므로 작업이 실패합니다.
내가 뭘 잘못하고 있니?
내 척하기 클라이언트 : bootstrap.yml에서
@FeignClient(name="foo-service")
public interface FooFeignClient {
@RequestMapping(value = "/perform-check", method = POST)
ResponseEntity<FooResponse> performCheck(FooRequest fooRequest);
}
:
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableHazelcastClient
@EnableFeignClients
@RibbonClients({
@RibbonClient(name = "foo-service", configuration = MyApp.FooServiceRibbonConfig.class)
})
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
....
@Configuration
static class FooServiceRibbonConfig {
@Bean
@ConditionalOnMissingBean
public IClientConfig ribbonClientConfig() {
DefaultClientConfigImpl config = new DefaultClientConfigImpl();
config.loadProperties("foo-service");
return config;
}
@Bean
ServerList<Server> ribbonServerList(IClientConfig config) {
ConfigurationBasedServerList serverList = new ConfigurationBasedServerList();
serverList.initWithNiwsConfig(config);
return serverList;
}
}
}
'listOfServers'는 대소 문자를 구분하며'ListOfServers' 여야합니다. – spencergibb
@spencergibb'ListOfServers'도 작동하지 않았습니다. 나는 여기에 조언을 따르려고 노력했다 https://github.com/spring-cloud/spring-cloud-netflix/issues/325 – vegemite4me
문제를 재현하는 샘플 프로젝트를 제공해야합니다. – spencergibb