Added port number to response (#3431)
This commit is contained in:
parent
f993bc0435
commit
a9d5b406a5
@ -21,12 +21,17 @@ public class EurekaClientApplication implements GreetingController {
|
|||||||
@Value("${spring.application.name}")
|
@Value("${spring.application.name}")
|
||||||
private String appName;
|
private String appName;
|
||||||
|
|
||||||
|
@Value("${server.port}")
|
||||||
|
private String portNumber;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(EurekaClientApplication.class, args);
|
SpringApplication.run(EurekaClientApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String greeting() {
|
public String greeting() {
|
||||||
return String.format("Hello from '%s'!", eurekaClient.getApplication(appName).getName());
|
System.out.println("Request received on port number " + portNumber);
|
||||||
|
return String.format("Hello from '%s with Port Number %s'!", eurekaClient.getApplication(appName)
|
||||||
|
.getName(), portNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: spring-cloud-eureka-client
|
name: spring-cloud-eureka-client
|
||||||
|
|
||||||
server:
|
server:
|
||||||
port: 0
|
port: 8081
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user