Refactored implementation of GreetingController

This commit is contained in:
Christian Rädel 2016-08-19 14:20:57 +02:00
parent 16e49dd8c2
commit cb3a7518c5
1 changed files with 0 additions and 22 deletions

View File

@ -1,22 +0,0 @@
package com.baeldung.spring.cloud.eureka.client;
import com.netflix.discovery.EurekaClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GreetingControllerImpl implements GreetingController {
@Autowired
@Lazy
private EurekaClient eurekaClient;
@Value("${spring.application.name}")
private String appName;
@Override
public String greeting() {
return String.format("Hello from '%s'!", eurekaClient.getApplication(appName).getName());
}
}