Commit 88f43e99 by Nepxion

增加扩展性

parent e45482d4
......@@ -11,6 +11,7 @@ package com.nepxion.discovery.plugin.framework.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.consul.discovery.ConsulDiscoveryProperties;
import org.springframework.cloud.consul.discovery.ConsulRibbonClientConfiguration;
import org.springframework.context.annotation.Bean;
......@@ -36,6 +37,7 @@ public class ConsulLoadBalanceConfiguration {
private ConsulClient client;
@Bean
@ConditionalOnMissingBean
public ServerList<?> ribbonServerList(IClientConfig config, ConsulDiscoveryProperties properties) {
ConsulServerListDecorator serverList = new ConsulServerListDecorator(client, properties);
serverList.initWithNiwsConfig(config);
......
......@@ -11,6 +11,7 @@ package com.nepxion.discovery.plugin.framework.configuration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cloud.zookeeper.discovery.ZookeeperRibbonClientConfiguration;
import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistry;
import org.springframework.context.annotation.Bean;
......@@ -35,6 +36,7 @@ public class ZookeeperLoadBalanceConfiguration {
private ZookeeperServiceRegistry registry;
@Bean
@ConditionalOnMissingBean
public ServerList<?> ribbonServerList(IClientConfig config) {
@SuppressWarnings("deprecation")
ZookeeperServerListDecorator serverList = new ZookeeperServerListDecorator(this.registry.getServiceDiscoveryRef().get());
......
......@@ -14,7 +14,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import org.springframework.beans.factory.annotation.Autowired;
import com.nepxion.discovery.plugin.framework.listener.discovery.DiscoveryListener;
import com.netflix.loadbalancer.Server;
// 因为内置监听触发的时候,需要优先过滤,所以顺序执行
......@@ -26,9 +25,6 @@ public class LoadBalanceListenerExecutor {
private VersionFilterLoadBalanceListener versionFilterLoadBalanceListener;
@Autowired
private List<DiscoveryListener> discoveryListenerList;
@Autowired
private ReentrantReadWriteLock reentrantReadWriteLock;
public void onGetServers(String serviceId, List<? extends Server> servers) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment