@Test void should_be_do_nothing_when_dataCenter_is_amazon() { doReturn(AmazonInfo.Builder.newBuilder().build()).when(eurekaInstanceConfigBean).getDataCenterInfo(); assertThat(processor.postProcessAfterInitialization(eurekaInstanceConfigBean, "beanName")) .isEqualTo(eurekaInstanceConfigBean); verify(eurekaInstanceConfigBean, never()).setDataCenterInfo(any()); }
@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);  }