com.nepxion.discovery.plugin.framework.context.EurekaApplicationContextInitializer Maven / Gradle / Ivy
package com.nepxion.discovery.plugin.framework.context;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import org.springframework.beans.BeansException;
import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry;
import org.springframework.context.ConfigurableApplicationContext;
import com.nepxion.discovery.plugin.framework.decorator.EurekaServiceRegistryDecorator;
public class EurekaApplicationContextInitializer extends PluginApplicationContextInitializer {
@Override
protected Object afterInitialization(ConfigurableApplicationContext applicationContext, Object bean, String beanName) throws BeansException {
if (bean instanceof EurekaServiceRegistry) {
EurekaServiceRegistry eurekaServiceRegistry = (EurekaServiceRegistry) bean;
return new EurekaServiceRegistryDecorator(eurekaServiceRegistry, applicationContext);
/*} else if (bean instanceof EurekaInstanceConfigBean) {
EurekaInstanceConfigBean eurekaInstanceConfig = (EurekaInstanceConfigBean) bean;
eurekaInstanceConfig.setPreferIpAddress(true);
return bean;*/
} else {
return bean;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy