Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Table of Contents

1. [display] build.gradle에 dependency 추가

Code Block
compile('org.springframework.cloud:spring-cloud-starter-netflix-ribbon')

2. [display] DisplayApplication의 RestTemplate 빈에 @LoadBalanced 추가

Code Block
@LoadBalanced
public RestTemplate restTemplate() {
    return new RestTemplate();
}

3. [display] ProductRemoteServiceImpl에서 주소 제거하고 `product` 로 변경

Code Block
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 설정 넣기

Code Block
product:
  ribbon:
    listOfServers: localhost:8082,localhost:7777
    MaxAutoRetries: 0
    MaxAutoRetriesNextServer: 1