View Javadoc
1   package cn.home1.cloud.netflix.eureka.server;
2   
3   import lombok.extern.slf4j.Slf4j;
4   
5   import org.springframework.beans.factory.annotation.Autowired;
6   import org.springframework.boot.autoconfigure.SpringBootApplication;
7   import org.springframework.boot.builder.SpringApplicationBuilder;
8   import org.springframework.boot.context.event.ApplicationReadyEvent;
9   import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
10  import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
11  import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
12  import org.springframework.context.event.EventListener;
13  
14  /**
15   * Created by zhanghaolun on 16/9/26.
16   */
17  @EnableEurekaServer
18  @SpringBootApplication
19  @Slf4j
20  public class EurekaServer {
21  
22      @Autowired
23      private EurekaClientConfigBean eurekaClientConfig;
24  
25      @Autowired
26      private EurekaInstanceConfigBean eurekaInstanceConfig;
27  
28      public static void main(final String... args) {
29          new SpringApplicationBuilder(EurekaServer.class).web(true).run(args);
30      }
31  
32      @EventListener(ApplicationReadyEvent.class)
33      public void printImportantInfo() {
34          log.info("eureka.client.service-url.defaultZone: {}", this.eurekaClientConfig.getServiceUrl().get("defaultZone"));
35          log.info("eureka.instance.hostname: {}", this.eurekaInstanceConfig.getHostname());
36      }
37  }