You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 5
Next »
0. 개요
1. [display] build.gradle에 dependency 추가
compile('org.springframework.cloud:spring-cloud-starter-netflix-ribbon')
compile('org.springframework.retry:spring-retry:1.2.2.RELEASE')
2. [display] DisplayApplication의 RestTemplate 빈에 @LoadBalanced 추가
@LoadBalanced
public RestTemplate restTemplate() {
return new RestTemplate();
}
3. [display] ProductRemoteServiceImpl에서 주소 제거하고 `product` 로 변경
public class ProductRemoteServiceImpl implements ProductRemoteService {
//private static final String url = "http://localhost:8082/products/";
private static final String url = "http://product/products/";
private final RestTemplate restTemplate;
}
4. [display] application.yml에 ribbon 설정 넣기
product:
ribbon:
listOfServers: localhost:8082,localhost:7777
MaxAutoRetries: 0
MaxAutoRetriesNextServer: 1