This is an automated email from the ASF dual-hosted git repository. wujimin pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
commit ea0b85e6bf64a14d7b26738cb69bed36d9c8926c Author: liubao <bi...@qq.com> AuthorDate: Sat May 30 11:18:13 2020 +0800 [SCB-1960]delete spring-boot-starter-discovery and spring-boot-starter-gateway --- coverage-reports/pom.xml | 13 ---- dependencies/bom/pom.xml | 15 ---- distribution/pom.xml | 13 ---- spring-boot/pom.xml | 1 - spring-boot/spring-boot-common/pom.xml | 53 ------------- .../springboot/common/AbstractDiscoveryClient.java | 73 ----------------- .../springboot/common/InstanceDiscoveryFilter.java | 78 ------------------- .../pom.xml | 91 ---------------------- .../starter/discovery/ScbDiscoveryClient.java | 43 ---------- .../discovery/ScbDiscoveryClientConfiguration.java | 36 --------- .../discovery/ScbRibbonClientConfiguration.java | 40 ---------- .../starter/discovery/ScbRibbonConfiguration.java | 34 -------- .../ScbRibbonEndpointDiscoveryFilter.java | 45 ----------- .../starter/discovery/ServiceCombServerList.java | 61 --------------- .../starter/discovery/package-info.java | 17 ---- .../src/main/resources/META-INF/spring.factories | 24 ------ .../pom.xml | 62 --------------- spring-boot/spring-boot-starters/pom.xml | 2 - 18 files changed, 701 deletions(-) diff --git a/coverage-reports/pom.xml b/coverage-reports/pom.xml index f42cca4..133390a 100644 --- a/coverage-reports/pom.xml +++ b/coverage-reports/pom.xml @@ -234,23 +234,10 @@ <!-- spring boot --> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-common</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-discovery</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-gateway</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter-servlet</artifactId> </dependency> <dependency> diff --git a/dependencies/bom/pom.xml b/dependencies/bom/pom.xml index 7b39a5b..83383dc 100644 --- a/dependencies/bom/pom.xml +++ b/dependencies/bom/pom.xml @@ -274,26 +274,11 @@ <!-- ServiceComb: spring boot --> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-common</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-discovery</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-gateway</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter-servlet</artifactId> <version>${project.version}</version> </dependency> diff --git a/distribution/pom.xml b/distribution/pom.xml index 183d94e..2b17138 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -232,23 +232,10 @@ <!-- spring boot --> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-common</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-discovery</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-gateway</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> <artifactId>java-chassis-spring-boot-starter-servlet</artifactId> </dependency> <dependency> diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index 7e6783f..9e6ce68 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -32,7 +32,6 @@ <name>Java Chassis::Spring Boot</name> <modules> - <module>spring-boot-common</module> <module>spring-boot-starters</module> </modules> diff --git a/spring-boot/spring-boot-common/pom.xml b/spring-boot/spring-boot-common/pom.xml deleted file mode 100644 index 00539dd..0000000 --- a/spring-boot/spring-boot-common/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>java-chassis-spring-boot</artifactId> - <groupId>org.apache.servicecomb</groupId> - <version>2.1.0-SNAPSHOT</version> - </parent> - - <modelVersion>4.0.0</modelVersion> - - <artifactId>java-chassis-spring-boot-common</artifactId> - <name>Java Chassis::Foundations::Spring Boot Common</name> - - <dependencies> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>registry-service-center</artifactId> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.8</source> - <target>1.8</target> - </configuration> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file diff --git a/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/AbstractDiscoveryClient.java b/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/AbstractDiscoveryClient.java deleted file mode 100644 index 881125f..0000000 --- a/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/AbstractDiscoveryClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot.common; - -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.servicecomb.foundation.common.cache.VersionedCache; -import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx; -import org.apache.servicecomb.serviceregistry.RegistryUtils; -import org.apache.servicecomb.registry.api.registry.Microservice; -import org.apache.servicecomb.registry.definition.DefinitionConst; -import org.apache.servicecomb.registry.discovery.DiscoveryContext; -import org.apache.servicecomb.registry.discovery.DiscoveryFilter; -import org.apache.servicecomb.registry.discovery.DiscoveryTree; - -public abstract class AbstractDiscoveryClient { - - private Map<String, DiscoveryTree> discoveryTrees = new ConcurrentHashMapEx<>(); - - private DiscoveryFilter filter; - - public AbstractDiscoveryClient(DiscoveryFilter filter) { - this.filter = filter; - } - - public <T> List<T> doGetInstances(final String serviceId) { - DiscoveryContext context = new DiscoveryContext(); - context.setInputParameters(serviceId); - - DiscoveryTree discoveryTree = discoveryTrees.computeIfAbsent(serviceId, key -> { - DiscoveryTree tree = new DiscoveryTree(); - tree.addFilter(filter); - return tree; - }); - - VersionedCache serversVersionedCache = discoveryTree.discovery(context, - RegistryUtils.getAppId(), - serviceId, - DefinitionConst.VERSION_RULE_ALL); - - return serversVersionedCache.data(); - } - - public List<String> getServices() { - Set<String> uniqueServiceNames = new LinkedHashSet<>(); - RegistryUtils.executeOnEachServiceRegistry(sr -> { - List<Microservice> allMicroservices = sr.getServiceRegistryClient().getAllMicroservices(); - if (null == allMicroservices || allMicroservices.isEmpty()) { - return; - } - allMicroservices.forEach(ms -> uniqueServiceNames.add(ms.getServiceName())); - }); - return new ArrayList<>(uniqueServiceNames); - } -} diff --git a/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/InstanceDiscoveryFilter.java b/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/InstanceDiscoveryFilter.java deleted file mode 100644 index befcbaf..0000000 --- a/spring-boot/spring-boot-common/src/main/java/org/apache/servicecomb/springboot/common/InstanceDiscoveryFilter.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot.common; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.servicecomb.foundation.common.net.URIEndpointObject; -import org.apache.servicecomb.registry.api.registry.MicroserviceInstance; -import org.apache.servicecomb.registry.discovery.DiscoveryContext; -import org.apache.servicecomb.registry.discovery.DiscoveryFilter; -import org.apache.servicecomb.registry.discovery.DiscoveryTreeNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class InstanceDiscoveryFilter implements DiscoveryFilter { - - private static final Logger LOGGER = LoggerFactory.getLogger(InstanceDiscoveryFilter.class); - - public interface InstanceFactory { - Object createInstance(String instanceId, String serviceId, URIEndpointObject uri); - } - - InstanceFactory instanceFactory; - - public InstanceDiscoveryFilter(InstanceFactory factory) { - instanceFactory = factory; - } - - @Override - public int getOrder() { - return Short.MAX_VALUE; - } - - @Override - public DiscoveryTreeNode discovery(DiscoveryContext context, DiscoveryTreeNode parent) { - return parent.children() - .computeIfAbsent(context.getInputParameters(), etn -> createDiscoveryTreeNode(context, parent)); - } - - @SuppressWarnings("unchecked") - protected DiscoveryTreeNode createDiscoveryTreeNode(DiscoveryContext context, - DiscoveryTreeNode parent) { - String serviceName = context.getInputParameters(); - - List<Object> instances = new ArrayList<>(); - for (MicroserviceInstance instance : ((Map<String, MicroserviceInstance>) parent.data()).values()) { - for (String endpoint : instance.getEndpoints()) { - String scheme = endpoint.split(":", 2)[0]; - if (!scheme.equalsIgnoreCase("rest")) { - LOGGER.info("Endpoint {} is not supported in Spring Cloud, ignoring.", endpoint); - continue; - } - URIEndpointObject uri = new URIEndpointObject(endpoint); - instances.add(instanceFactory.createInstance(instance.getInstanceId(), instance.getServiceId(), uri)); - } - } - - return new DiscoveryTreeNode() - .subName(parent, serviceName) - .data(instances); - } -}; \ No newline at end of file diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/pom.xml b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/pom.xml deleted file mode 100644 index f632174..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <artifactId>java-chassis-spring-boot-starters</artifactId> - <groupId>org.apache.servicecomb</groupId> - <version>2.1.0-SNAPSHOT</version> - </parent> - - <artifactId>java-chassis-spring-boot-starter-discovery</artifactId> - <name>Java Chassis::Spring Boot Starter::Discovery</name> - - <dependencies> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter</artifactId> - <exclusions> - <exclusion> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </exclusion> - <exclusion> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-commons</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-context</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-netflix-ribbon</artifactId> - <exclusions> - <exclusion> - <groupId>javax.ws.rs</groupId> - <artifactId>jsr311-api</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.jmockit</groupId> - <artifactId>jmockit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>registry-service-center</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-common</artifactId> - </dependency> - </dependencies> -</project> diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClient.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClient.java deleted file mode 100644 index 22507af..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; - -import java.util.List; - -import org.apache.servicecomb.foundation.common.net.URIEndpointObject; -import org.apache.servicecomb.springboot.common.AbstractDiscoveryClient; -import org.apache.servicecomb.springboot.common.InstanceDiscoveryFilter; -import org.springframework.cloud.client.DefaultServiceInstance; -import org.springframework.cloud.client.ServiceInstance; -import org.springframework.cloud.client.discovery.DiscoveryClient; - -public class ScbDiscoveryClient extends AbstractDiscoveryClient implements DiscoveryClient { - - public ScbDiscoveryClient() { - super(new InstanceDiscoveryFilter((String instanceId, String serviceId, URIEndpointObject uri) -> - new DefaultServiceInstance(instanceId, serviceId, uri.getHostOrIp(), uri.getPort(), uri.isSslEnabled()))); - } - - @Override - public String description() { - return "Spring Cloud 2 CSE Discovery Client"; - } - - public List<ServiceInstance> getInstances(String serviceId) { - return super.doGetInstances(serviceId); - } -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClientConfiguration.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClientConfiguration.java deleted file mode 100644 index 75730b7..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbDiscoveryClientConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; - -import org.springframework.boot.autoconfigure.AutoConfigureBefore; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.cloud.client.discovery.DiscoveryClient; -import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; - -@AutoConfigureBefore(SimpleDiscoveryClientAutoConfiguration.class) -@Configuration -public class ScbDiscoveryClientConfiguration { - @Bean - @Order(5000) - @ConditionalOnProperty(value = "servicecomb.discoveryClient.enabled", havingValue = "true", matchIfMissing = true) - public DiscoveryClient cseDiscoveryClient() { - return new ScbDiscoveryClient(); - } -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonClientConfiguration.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonClientConfiguration.java deleted file mode 100644 index bf5eb80..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonClientConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; - -import org.springframework.context.annotation.Bean; - -import com.netflix.client.config.IClientConfig; -import com.netflix.loadbalancer.Server; -import com.netflix.loadbalancer.ServerList; - -/** - * Custom {@link org.springframework.cloud.netflix.ribbon.RibbonClient} configuration must not be - * scanned by spring. - * - * @see <a href="http://cloud.spring.io/spring-cloud-static/Camden.SR4/#_customizing_the_ribbon_client"> - * Customizing the Ribbon Client </a> - */ -public class ScbRibbonClientConfiguration { - @Bean - public ServerList<Server> ribbonServerList( - IClientConfig config) { - ServiceCombServerList serverList = new ServiceCombServerList(); - serverList.initWithNiwsConfig(config); - return serverList; - } -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonConfiguration.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonConfiguration.java deleted file mode 100644 index 79f2b3c..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonConfiguration.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; - -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration; -import org.springframework.cloud.netflix.ribbon.RibbonClients; -import org.springframework.cloud.netflix.ribbon.SpringClientFactory; -import org.springframework.context.annotation.Configuration; - -@Configuration -@EnableConfigurationProperties -@ConditionalOnBean(SpringClientFactory.class) -@AutoConfigureAfter(RibbonAutoConfiguration.class) -@RibbonClients(defaultConfiguration = ScbRibbonClientConfiguration.class) -public class ScbRibbonConfiguration { - -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonEndpointDiscoveryFilter.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonEndpointDiscoveryFilter.java deleted file mode 100644 index 20b8d9f..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ScbRibbonEndpointDiscoveryFilter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.springboot2.starter.discovery; - -import org.apache.servicecomb.foundation.common.net.URIEndpointObject; -import org.apache.servicecomb.registry.api.registry.MicroserviceInstance; -import org.apache.servicecomb.registry.discovery.AbstractEndpointDiscoveryFilter; -import org.apache.servicecomb.registry.discovery.DiscoveryContext; -import org.apache.servicecomb.registry.discovery.DiscoveryTreeNode; - -import com.netflix.loadbalancer.Server; - -public class ScbRibbonEndpointDiscoveryFilter extends AbstractEndpointDiscoveryFilter { - @Override - protected String findTransportName(DiscoveryContext context, DiscoveryTreeNode parent) { - //only need rest endpoints - return "rest"; - } - - @Override - protected Object createEndpoint(String transportName, String endpoint, MicroserviceInstance instance) { - URIEndpointObject uri = new URIEndpointObject(endpoint); - return new Server(uri.getHostOrIp(), uri.getPort()); - } - - @Override - public int getOrder() { - return (int) Short.MAX_VALUE - 1; - } -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ServiceCombServerList.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ServiceCombServerList.java deleted file mode 100644 index f5c635f..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/ServiceCombServerList.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; - -import java.util.List; - -import org.apache.servicecomb.foundation.common.cache.VersionedCache; -import org.apache.servicecomb.serviceregistry.RegistryUtils; -import org.apache.servicecomb.registry.definition.DefinitionConst; -import org.apache.servicecomb.registry.discovery.DiscoveryContext; -import org.apache.servicecomb.registry.discovery.DiscoveryTree; - -import com.netflix.client.config.IClientConfig; -import com.netflix.loadbalancer.AbstractServerList; -import com.netflix.loadbalancer.Server; - -public class ServiceCombServerList extends AbstractServerList<Server> { - - private DiscoveryTree discoveryTree = new DiscoveryTree(); - - private String serviceId; - - public ServiceCombServerList() { - discoveryTree.addFilter(new ScbRibbonEndpointDiscoveryFilter()); - } - - @Override - public List<Server> getInitialListOfServers() { - DiscoveryContext context = new DiscoveryContext(); - context.setInputParameters(serviceId); - VersionedCache serversVersionedCache = discoveryTree.discovery(context, - RegistryUtils.getAppId(), - serviceId, - DefinitionConst.VERSION_RULE_ALL); - return serversVersionedCache.data(); - } - - @Override - public List<Server> getUpdatedListOfServers() { - return getInitialListOfServers(); - } - - @Override - public void initWithNiwsConfig(IClientConfig iClientConfig) { - this.serviceId = iClientConfig.getClientName(); - } -} diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/package-info.java b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/package-info.java deleted file mode 100644 index 0feb613..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot2/starter/discovery/package-info.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.springboot2.starter.discovery; diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/resources/META-INF/spring.factories b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/resources/META-INF/spring.factories deleted file mode 100644 index de5a9fc..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-discovery/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,24 +0,0 @@ -## --------------------------------------------------------------------------- -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## --------------------------------------------------------------------------- - -org.apache.servicecomb.springboot.starter.provider.EnableServiceComb=\ - org.apache.servicecomb.springboot2.starter.discovery.ScbDiscoveryClientConfiguration,\ - org.apache.servicecomb.springboot2.starter.discovery.ScbRibbonConfiguration -org.springframework.cloud.client.discovery.EnableDiscoveryClient=\ - org.apache.servicecomb.springboot2.starter.discovery.ScbDiscoveryClientConfiguration -org.springframework.cloud.netflix.ribbon.RibbonClient=\ - org.apache.servicecomb.springboot2.starter.discovery.ScbRibbonConfiguration \ No newline at end of file diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-gateway/pom.xml b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-gateway/pom.xml deleted file mode 100644 index 2c75cca..0000000 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-gateway/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <artifactId>java-chassis-spring-boot-starters</artifactId> - <groupId>org.apache.servicecomb</groupId> - <version>2.1.0-SNAPSHOT</version> - </parent> - - <artifactId>java-chassis-spring-boot-starter-gateway</artifactId> - <name>Java Chassis::Spring Boot Starter::Gateway</name> - - <dependencies> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-starter-gateway</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.cloud</groupId> - <artifactId>spring-cloud-gateway-webflux</artifactId> - </dependency> - - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - </dependency> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-core</artifactId> - </dependency> - <dependency> - <groupId>org.apache.servicecomb</groupId> - <artifactId>java-chassis-spring-boot-starter-discovery</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.servicecomb</groupId> - <artifactId>provider-springmvc</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> -</project> \ No newline at end of file diff --git a/spring-boot/spring-boot-starters/pom.xml b/spring-boot/spring-boot-starters/pom.xml index 0629cd0..0db8e4a 100644 --- a/spring-boot/spring-boot-starters/pom.xml +++ b/spring-boot/spring-boot-starters/pom.xml @@ -35,8 +35,6 @@ <module>java-chassis-spring-boot-starter</module> <module>java-chassis-spring-boot-starter-servlet</module> <module>java-chassis-spring-boot-starter-standalone</module> - <module>java-chassis-spring-boot-starter-discovery</module> - <module>java-chassis-spring-boot-starter-gateway</module> </modules> <build>