Added port number to response (#3431)

This commit is contained in:
ShyamVeda 2018-01-17 02:21:01 +05:30 committed by Grzegorz Piwowarek
parent f993bc0435
commit a9d5b406a5
2 changed files with 7 additions and 2 deletions

View File

@ -21,12 +21,17 @@ public class EurekaClientApplication implements GreetingController {
@Value("${spring.application.name}")
private String appName;
@Value("${server.port}")
private String portNumber;
public static void main(String[] args) {
SpringApplication.run(EurekaClientApplication.class, args);
}
@Override
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);
}
}

View File

@ -3,7 +3,7 @@ spring:
name: spring-cloud-eureka-client
server:
port: 0
port: 8081
eureka:
client: