@Test void should_be_set_metadata_using_default_when_not_exists_property() { eurekaInstanceConfigBean.setInstanceId("test1"); assertThat(processor.postProcessAfterInitialization(eurekaInstanceConfigBean, "beanName")) .isEqualTo(eurekaInstanceConfigBean); final AmazonInfo dataCenterInfo = (AmazonInfo) eurekaInstanceConfigBean.getDataCenterInfo(); assertThat(dataCenterInfo.getMetadata()).containsEntry("availability-zone", "defaultZone") .containsEntry("ami-id", "n/a") .containsEntry("instance-id", "test1") .containsEntry("public-hostname", hostInfo.getHostname()) .containsEntry("public-ipv4", hostInfo.getIpAddress()) .containsEntry("local-ipv4", hostInfo.getIpAddress()); }
@Override public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (!isAssignableValue(EurekaInstanceConfigBean.class, bean)) { return bean; } final EurekaInstanceConfigBean config = (EurekaInstanceConfigBean) bean; if (isAmazonDataCenter(config)) { return bean; } final AmazonInfo amazonInfo = createAmazonInfo(config); config.setDataCenterInfo(amazonInfo); LOGGER.warn("DataCenter changed. {}", amazonInfo); return bean; }
EVCacheServerEurekaInstanceConfigBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (!isAssignableValue(EurekaInstanceConfigBean.class, bean)) { return bean; } final EurekaInstanceConfigBean config = (EurekaInstanceConfigBean) bean; if (isAmazonDataCenter(config)) { return bean; } final AmazonInfo amazonInfo = createAmazonInfo(config); config.setDataCenterInfo(amazonInfo); LOGGER.warn("DataCenter changed. {}", amazonInfo); return bean; } }
EVCacheServerEurekaInstanceConfigBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (!isAssignableValue(EurekaInstanceConfigBean.class, bean)) { return bean; } final EurekaInstanceConfigBean config = (EurekaInstanceConfigBean) bean; if (isAmazonDataCenter(config)) { return bean; } final AmazonInfo amazonInfo = createAmazonInfo(config); config.setDataCenterInfo(amazonInfo); LOGGER.warn("DataCenter changed. {}", amazonInfo); return bean; } EVCacheServerEurekaInstanceConfigBeanPostProcessor(final ConfigurableEnvironment environment,
                                                       final EurekaClientConfigBean eurekaClientConfigBean); }
EVCacheServerEurekaInstanceConfigBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (!isAssignableValue(EurekaInstanceConfigBean.class, bean)) { return bean; } final EurekaInstanceConfigBean config = (EurekaInstanceConfigBean) bean; if (isAmazonDataCenter(config)) { return bean; } final AmazonInfo amazonInfo = createAmazonInfo(config); config.setDataCenterInfo(amazonInfo); LOGGER.warn("DataCenter changed. {}", amazonInfo); return bean; } EVCacheServerEurekaInstanceConfigBeanPostProcessor(final ConfigurableEnvironment environment,
                                                       final EurekaClientConfigBean eurekaClientConfigBean); @Override Object postProcessBeforeInitialization(final Object bean, final String beanName); @Override Object postProcessAfterInitialization(final Object bean, final String beanName); }
EVCacheServerEurekaInstanceConfigBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(final Object bean, final String beanName) { if (!isAssignableValue(EurekaInstanceConfigBean.class, bean)) { return bean; } final EurekaInstanceConfigBean config = (EurekaInstanceConfigBean) bean; if (isAmazonDataCenter(config)) { return bean; } final AmazonInfo amazonInfo = createAmazonInfo(config); config.setDataCenterInfo(amazonInfo); LOGGER.warn("DataCenter changed. {}", amazonInfo); return bean; } EVCacheServerEurekaInstanceConfigBeanPostProcessor(final ConfigurableEnvironment environment,
                                                       final EurekaClientConfigBean eurekaClientConfigBean); @Override Object postProcessBeforeInitialization(final Object bean, final String beanName); @Override Object postProcessAfterInitialization(final Object bean, final String beanName);  }