All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nepxion.discovery.plugin.framework.configuration.NacosLoadBalanceConfiguration Maven / Gradle / Ivy

There is a newer version: 6.2.0
Show newest version
package com.nepxion.discovery.plugin.framework.configuration;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.ConfigurableEnvironment; import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration; import com.nepxion.discovery.plugin.framework.decorator.NacosServerListDecorator; import com.nepxion.discovery.plugin.framework.listener.loadbalance.LoadBalanceListenerExecutor; import com.netflix.client.config.IClientConfig; import com.netflix.loadbalancer.ServerList; @Configuration @AutoConfigureAfter(NacosRibbonClientConfiguration.class) public class NacosLoadBalanceConfiguration { @Autowired private ConfigurableEnvironment environment; @Autowired private LoadBalanceListenerExecutor loadBalanceListenerExecutor; @Bean public ServerList ribbonServerList(IClientConfig config, NacosDiscoveryProperties nacosDiscoveryProperties) { NacosServerListDecorator serverList = new NacosServerListDecorator(nacosDiscoveryProperties); serverList.initWithNiwsConfig(config); serverList.setEnvironment(environment); serverList.setLoadBalanceListenerExecutor(loadBalanceListenerExecutor); return serverList; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy