Commit c1704235 by Spencer Gibb

polish

parent 572220ae
...@@ -16,9 +16,11 @@ ...@@ -16,9 +16,11 @@
package org.springframework.cloud.netflix.eureka.sample; package org.springframework.cloud.netflix.eureka.sample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository; import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
...@@ -36,6 +38,9 @@ import com.netflix.appinfo.InstanceInfo; ...@@ -36,6 +38,9 @@ import com.netflix.appinfo.InstanceInfo;
@EnableEurekaClient @EnableEurekaClient
public class EurekaSampleApplication { public class EurekaSampleApplication {
@Autowired
DiscoveryClient discoveryClient;
@Bean @Bean
public InMemoryMetricRepository inMemoryMetricRepository() { public InMemoryMetricRepository inMemoryMetricRepository() {
return new InMemoryMetricRepository(); return new InMemoryMetricRepository();
...@@ -54,7 +59,7 @@ public class EurekaSampleApplication { ...@@ -54,7 +59,7 @@ public class EurekaSampleApplication {
@RequestMapping("/") @RequestMapping("/")
public String home() { public String home() {
return "Hello world"; return "Hello world "+discoveryClient.getLocalServiceInstance().getUri();
} }
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -17,23 +17,14 @@ ...@@ -17,23 +17,14 @@
package org.springframework.cloud.netflix.sidecar; package org.springframework.cloud.netflix.sidecar;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.metrics.repository.InMemoryMetricRepository;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication @SpringBootApplication
@EnableSidecar @EnableSidecar
@EnableDiscoveryClient
@RestController @RestController
public class SidecarApplication { public class SidecarApplication {
@Bean
public InMemoryMetricRepository inMemoryMetricRepository() {
return new InMemoryMetricRepository();
}
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SidecarApplication.class, args); SpringApplication.run(SidecarApplication.class, args);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment