LoadBalancer-03
7923 ワード
| first-service.java
1. application.yml
1. application.yml
1. application.yml
server:
port: 8082
spring:
application:
name: my-second-service
eureka:
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: http://localhost:8761/eureka
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
2. SecondServiceController.java@RestController
@Slf4j
@RequestMapping("/second-service")
public class SecondServiceController {
@GetMapping("/welcome")
public String welcome() {
return "Welcome to the Second service";
}
@GetMapping("/message")
public String message(@RequestHeader("second-request") String header) {
log.info(header);
return "Hello World in Second Service";
}
@GetMapping("/check")
public String check() {
return "Hi there. This is a message from Second Service.";
}
}
| second-service.java1. application.yml
server:
port: 8082
spring:
application:
name: my-second-service
eureka:
client:
fetch-registry: true
register-with-eureka: true
service-url:
defaultZone: http://localhost:8761/eureka
2. SecondServiceController.java@RestController
@Slf4j
@RequestMapping("/second-service")
public class SecondServiceController {
@GetMapping("/welcome")
public String welcome() {
return "Welcome to the Second service";
}
@GetMapping("/message")
public String message(@RequestHeader("second-request") String header) {
log.info(header);
return "Hello World in Second Service";
}
@GetMapping("/check")
public String check() {
return "Hi there. This is a message from Second Service.";
}
}
Reference
この問題について(LoadBalancer-03), 我々は、より多くの情報をここで見つけました https://velog.io/@kyhslam/LoadBalancer-03テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol