Commit c3f08bb0 by Nepxion

升级到F版

parent bf2a0670
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId> <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -9,7 +9,7 @@ package com.nepxion.discovery.console.configuration; ...@@ -9,7 +9,7 @@ package com.nepxion.discovery.console.configuration;
* @version 1.0 * @version 1.0
*/ */
import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
......
...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
...@@ -26,7 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -26,7 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfiguration extends WebMvcConfigurerAdapter { public class SwaggerConfiguration implements WebMvcConfigurer {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
......
...@@ -9,7 +9,7 @@ package com.nepxion.discovery.plugin.admincenter.configuration; ...@@ -9,7 +9,7 @@ package com.nepxion.discovery.plugin.admincenter.configuration;
* @version 1.0 * @version 1.0
*/ */
import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
......
...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -13,7 +13,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.PathSelectors;
...@@ -26,7 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -26,7 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfiguration extends WebMvcConfigurerAdapter { public class SwaggerConfiguration implements WebMvcConfigurer {
@Value("${spring.application.name}") @Value("${spring.application.name}")
private String serviceName; private String serviceName;
......
...@@ -22,13 +22,7 @@ ...@@ -22,13 +22,7 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.cloud.netflix.ribbon.PropertiesFactory; import org.springframework.cloud.netflix.ribbon.PropertiesFactory;
import org.springframework.cloud.netflix.ribbon.RibbonClientName;
import org.springframework.cloud.netflix.ribbon.eureka.EurekaRibbonClientConfiguration; import org.springframework.cloud.netflix.ribbon.eureka.EurekaRibbonClientConfiguration;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -33,7 +34,7 @@ public class EurekaLoadBalanceConfiguration { ...@@ -33,7 +34,7 @@ public class EurekaLoadBalanceConfiguration {
@Value("${ribbon.eureka.approximateZoneFromHostname:false}") @Value("${ribbon.eureka.approximateZoneFromHostname:false}")
private boolean approximateZoneFromHostname = false; private boolean approximateZoneFromHostname = false;
@Value("${ribbon.client.name}") @RibbonClientName
private String serviceId = "client"; private String serviceId = "client";
@Autowired @Autowired
......
...@@ -9,10 +9,14 @@ package com.nepxion.discovery.plugin.framework.configuration; ...@@ -9,10 +9,14 @@ package com.nepxion.discovery.plugin.framework.configuration;
* @version 1.0 * @version 1.0
*/ */
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
import org.springframework.cloud.zookeeper.discovery.ZookeeperRibbonClientConfiguration; import org.springframework.cloud.zookeeper.discovery.ZookeeperRibbonClientConfiguration;
import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistry; import org.springframework.cloud.zookeeper.discovery.dependency.ConditionalOnDependenciesNotPassed;
import org.springframework.cloud.zookeeper.discovery.dependency.ConditionalOnDependenciesPassed;
import org.springframework.cloud.zookeeper.discovery.dependency.ZookeeperDependencies;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
...@@ -26,18 +30,27 @@ import com.netflix.loadbalancer.ServerList; ...@@ -26,18 +30,27 @@ import com.netflix.loadbalancer.ServerList;
@AutoConfigureAfter(ZookeeperRibbonClientConfiguration.class) @AutoConfigureAfter(ZookeeperRibbonClientConfiguration.class)
public class ZookeeperLoadBalanceConfiguration { public class ZookeeperLoadBalanceConfiguration {
@Autowired @Autowired
private ZookeeperServiceRegistry registry;
@Autowired
private ConfigurableEnvironment environment; private ConfigurableEnvironment environment;
@Autowired @Autowired
private LoadBalanceListenerExecutor loadBalanceListenerExecutor; private LoadBalanceListenerExecutor loadBalanceListenerExecutor;
@Bean @Bean
public ServerList<?> ribbonServerList(IClientConfig config) { @ConditionalOnDependenciesPassed
@SuppressWarnings("deprecation") public ServerList<?> ribbonServerListFromDependencies(IClientConfig config, ZookeeperDependencies zookeeperDependencies, ServiceDiscovery<ZookeeperInstance> serviceDiscovery) {
ZookeeperServerListDecorator serverList = new ZookeeperServerListDecorator(this.registry.getServiceDiscoveryRef().get()); ZookeeperServerListDecorator serverList = new ZookeeperServerListDecorator(serviceDiscovery);
serverList.initFromDependencies(config, zookeeperDependencies);
serverList.setEnvironment(environment);
serverList.setLoadBalanceListenerExecutor(loadBalanceListenerExecutor);
serverList.setServiceId(config.getClientName());
return serverList;
}
@Bean
@ConditionalOnDependenciesNotPassed
public ServerList<?> ribbonServerList(IClientConfig config, ServiceDiscovery<ZookeeperInstance> serviceDiscovery) {
ZookeeperServerListDecorator serverList = new ZookeeperServerListDecorator(serviceDiscovery);
serverList.initWithNiwsConfig(config); serverList.initWithNiwsConfig(config);
serverList.setEnvironment(environment); serverList.setEnvironment(environment);
serverList.setLoadBalanceListenerExecutor(loadBalanceListenerExecutor); serverList.setLoadBalanceListenerExecutor(loadBalanceListenerExecutor);
......
...@@ -9,11 +9,6 @@ package com.nepxion.discovery.plugin.framework.decorator; ...@@ -9,11 +9,6 @@ package com.nepxion.discovery.plugin.framework.decorator;
* @version 1.0 * @version 1.0
*/ */
import java.util.concurrent.atomic.AtomicReference;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.x.discovery.ServiceDiscovery;
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperRegistration; import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperRegistration;
import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistry; import org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistry;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
...@@ -89,16 +84,6 @@ public class ZookeeperServiceRegistryDecorator extends ZookeeperServiceRegistry ...@@ -89,16 +84,6 @@ public class ZookeeperServiceRegistryDecorator extends ZookeeperServiceRegistry
serviceRegistry.afterSingletonsInstantiated(); serviceRegistry.afterSingletonsInstantiated();
} }
@Deprecated
public CuratorFramework getCurator() {
return serviceRegistry.getCurator();
}
@Deprecated
public AtomicReference<ServiceDiscovery<ZookeeperInstance>> getServiceDiscoveryRef() {
return serviceRegistry.getServiceDiscoveryRef();
}
public ConfigurableEnvironment getEnvironment() { public ConfigurableEnvironment getEnvironment() {
return environment; return environment;
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId> <artifactId>spring-cloud-starter-netflix-ribbon</artifactId>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -14,7 +14,6 @@ import org.springframework.context.annotation.Configuration; ...@@ -14,7 +14,6 @@ import org.springframework.context.annotation.Configuration;
import com.nepxion.discovery.plugin.framework.cache.PluginCache; import com.nepxion.discovery.plugin.framework.cache.PluginCache;
import com.nepxion.discovery.plugin.framework.cache.RuleCache; import com.nepxion.discovery.plugin.framework.cache.RuleCache;
import com.nepxion.discovery.plugin.framework.context.PluginContainerInitializedHandler;
import com.nepxion.discovery.plugin.framework.context.PluginContextAware; import com.nepxion.discovery.plugin.framework.context.PluginContextAware;
import com.nepxion.discovery.plugin.framework.event.PluginEventWapper; import com.nepxion.discovery.plugin.framework.event.PluginEventWapper;
import com.nepxion.discovery.plugin.framework.event.PluginPublisher; import com.nepxion.discovery.plugin.framework.event.PluginPublisher;
...@@ -32,11 +31,6 @@ import com.nepxion.discovery.plugin.framework.listener.register.RegisterListener ...@@ -32,11 +31,6 @@ import com.nepxion.discovery.plugin.framework.listener.register.RegisterListener
@Configuration @Configuration
public class PluginAutoConfiguration { public class PluginAutoConfiguration {
@Bean @Bean
public PluginContainerInitializedHandler pluginContainerInitializedHandler() {
return new PluginContainerInitializedHandler();
}
@Bean
public PluginContextAware pluginContextAware() { public PluginContextAware pluginContextAware() {
return new PluginContextAware(); return new PluginContextAware();
} }
......
package com.nepxion.discovery.plugin.framework.context;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.context.ApplicationListener;
public class PluginContainerInitializedHandler implements ApplicationListener<EmbeddedServletContainerInitializedEvent> {
private int serverPort;
@Override
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
serverPort = event.getEmbeddedServletContainer().getPort();
}
public int getPort() {
return serverPort;
}
}
\ No newline at end of file
...@@ -64,12 +64,6 @@ public class DiscoveryClientDecorator implements DiscoveryClient { ...@@ -64,12 +64,6 @@ public class DiscoveryClientDecorator implements DiscoveryClient {
return discoveryClient.getServices(); return discoveryClient.getServices();
} }
@Deprecated
@Override
public ServiceInstance getLocalServiceInstance() {
return discoveryClient.getLocalServiceInstance();
}
@Override @Override
public String description() { public String description() {
return discoveryClient.description(); return discoveryClient.description();
......
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.14.RELEASE</version> <version>2.0.3.RELEASE</version>
</parent> </parent>
<properties> <properties>
<discovery.plugin.version>3.3.20</discovery.plugin.version> <discovery.plugin.version>3.3.20</discovery.plugin.version>
<spring.cloud.version>Edgware.SR4</spring.cloud.version> <spring.cloud.version>Finchley.RELEASE</spring.cloud.version>
<!-- <spring.cloud.version>Dalston.SR5</spring.cloud.version> -->
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
......
...@@ -13,12 +13,11 @@ ...@@ -13,12 +13,11 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.14.RELEASE</version> <version>2.0.3.RELEASE</version>
</parent> </parent>
<properties> <properties>
<spring.cloud.version>Edgware.SR4</spring.cloud.version> <spring.cloud.version>Finchley.RELEASE</spring.cloud.version>
<!-- <spring.cloud.version>Dalston.SR5</spring.cloud.version> -->
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
...@@ -38,7 +37,7 @@ ...@@ -38,7 +37,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -13,13 +13,12 @@ ...@@ -13,13 +13,12 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.14.RELEASE</version> <version>2.0.3.RELEASE</version>
</parent> </parent>
<properties> <properties>
<discovery.plugin.version>3.3.20</discovery.plugin.version> <discovery.plugin.version>3.3.20</discovery.plugin.version>
<spring.cloud.version>Edgware.SR4</spring.cloud.version> <spring.cloud.version>Finchley.RELEASE</spring.cloud.version>
<!-- <spring.cloud.version>Dalston.SR5</spring.cloud.version> -->
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
......
...@@ -35,11 +35,8 @@ ...@@ -35,11 +35,8 @@
<dom4j.version>1.6.1</dom4j.version> <dom4j.version>1.6.1</dom4j.version>
<caffeine.version>2.6.2</caffeine.version> <caffeine.version>2.6.2</caffeine.version>
<swagger.version>2.7.0</swagger.version> <swagger.version>2.7.0</swagger.version>
<spring.cloud.version>Edgware.SR4</spring.cloud.version> <spring.cloud.version>Finchley.RELEASE</spring.cloud.version>
<!-- <spring.cloud.version>Dalston.SR5</spring.cloud.version> --> <spring.boot.version>2.0.3.RELEASE</spring.boot.version>
<spring.cloud.consul.version>2.0.0.RELEASE</spring.cloud.consul.version>
<spring.cloud.zookeeper.version>2.0.0.RELEASE</spring.cloud.zookeeper.version>
<spring.boot.version>1.5.14.RELEASE</spring.boot.version>
<disruptor.version>3.3.7</disruptor.version> <disruptor.version>3.3.7</disruptor.version>
<log4j.version>2.9.1</log4j.version> <log4j.version>2.9.1</log4j.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
...@@ -171,22 +168,6 @@ ...@@ -171,22 +168,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-consul-dependencies</artifactId>
<version>${spring.cloud.consul.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-zookeeper-dependencies</artifactId>
<version>${spring.cloud.zookeeper.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId> <artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version> <version>${spring.boot.version}</version>
......
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