package com.cloudnative.reference;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class OrderServiceApplication {

	public static void main(String[] args) {
		SpringApplication.run(OrderServiceApplication.class, args);
	}
}

@@ -40,290 +40,1417 @@
 ort 
-org.springframework.boot.SpringApplication;%0Aimport org.springframework.boot.autoconfigure.SpringBootApplication;%0A%0A@SpringBootApplication%0Apublic class OrderServiceApplication %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09SpringApplication.run(OrderServiceApplication.class, args);%0A%09%7D%0A%7D%0A
+java.util.List;%0A%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.beans.factory.annotation.Value;%0Aimport org.springframework.boot.SpringApplication;%0Aimport org.springframework.boot.autoconfigure.SpringBootApplication;%0Aimport org.springframework.cloud.client.ServiceInstance;%0Aimport org.springframework.cloud.client.discovery.DiscoveryClient;%0Aimport org.springframework.cloud.context.config.annotation.RefreshScope;%0Aimport org.springframework.cloud.netflix.eureka.EnableEurekaClient;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0A@EnableEurekaClient%0A@SpringBootApplication%0Apublic class OrderServiceApplication %7B%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09SpringApplication.run(OrderServiceApplication.class, args);%0A%09%7D%0A%7D%0A%0A@RestController%0Aclass ServiceInstanceRestController %7B%0A%0A    @Autowired%0A    private DiscoveryClient discoveryClient;%0A%0A    @Value(%22$%7Bspring.application.name%7D%22)%0A    private String appName;%0A%0A    @RequestMapping(%22/instances%22)%0A    public List%3CServiceInstance%3E serviceInstancesByApplicationName() %7B%0A        return this.discoveryClient.getInstances(appName);%0A    %7D%0A%7D%0A%0A%0A@RefreshScope%0A@RestController%0Aclass MessageRestController %7B%0A%0A    @Value(%22$%7Bmessage%7D%22)%0A    private String message;%0A%0A    @RequestMapping(%22/message%22)%0A    String getMessage() %7B%0A        return this.message;%0A    %7D%0A%7D

order service now registers with discovery service