@Override public void onApplicationEvent(ContextRefreshedEvent event) { logger.info( "Registering application {} with eureka with status UP", instanceConfig.getAppname()); ApplicationInfoManager.getInstance().setInstanceStatus(InstanceStatus.UP); }
@PreDestroy public void close() { logger.info("Removing application {} from eureka", instanceConfig.getAppname()); DiscoveryManager.getInstance().shutdownComponent(); }
@Bean @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT) public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) { EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils); instance.setNonSecurePort(this.nonSecurePort); instance.setInstanceId(getDefaultInstanceId(this.env)); if (this.managementPort != this.nonSecurePort && this.managementPort != 0) { if (StringUtils.hasText(this.hostname)) { instance.setHostname(this.hostname); } String scheme = instance.getSecurePortEnabled() ? "https" : "http"; instance.setStatusPageUrl( scheme + "://" + instance.getHostname() + ":" + this.managementPort + instance.getStatusPageUrlPath()); instance.setHealthCheckUrl( scheme + "://" + instance.getHostname() + ":" + this.managementPort + instance.getHealthCheckUrlPath()); } return instance; }