Remove fastjson and gson transitive dependency (#10792)
This commit is contained in:
parent
51fc01c4b9
commit
fd103b7241
|
|
@ -62,15 +62,16 @@
|
|||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@
|
|||
*/
|
||||
package org.apache.dubbo.metadata.definition.model;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -46,7 +44,6 @@ public class TypeDefinition implements Serializable {
|
|||
* <p>
|
||||
* if this type is not ParameterizedType, the items is null or empty
|
||||
*/
|
||||
@SerializedName("items")
|
||||
private List<String> items;
|
||||
|
||||
/**
|
||||
|
|
@ -54,7 +51,6 @@ public class TypeDefinition implements Serializable {
|
|||
* <p>
|
||||
* If this type is not enum, enums is null or empty
|
||||
*/
|
||||
@SerializedName("enum")
|
||||
private List<String> enums;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@
|
|||
<httpclient_version>4.5.13</httpclient_version>
|
||||
<httpcore_version>4.4.6</httpcore_version>
|
||||
<fastjson_version>1.2.83</fastjson_version>
|
||||
<fastjson2_version>2.0.16</fastjson2_version>
|
||||
<fastjson2_version>2.0.17</fastjson2_version>
|
||||
<zookeeper_version>3.4.14</zookeeper_version>
|
||||
<curator_version>4.2.0</curator_version>
|
||||
<curator_test_version>2.12.0</curator_test_version>
|
||||
|
|
|
|||
|
|
@ -255,12 +255,6 @@
|
|||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>hessian-lite</artifactId>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- metadata -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
|
|
@ -351,17 +345,13 @@
|
|||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<artifactId>hessian-lite</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
|
|
@ -405,7 +395,6 @@
|
|||
<promoteTransitiveDependencies>false</promoteTransitiveDependencies>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>com.alibaba:hessian-lite</include>
|
||||
<include>org.apache.dubbo:dubbo-auth</include>
|
||||
<include>org.apache.dubbo:dubbo-cluster</include>
|
||||
<include>org.apache.dubbo:dubbo-common</include>
|
||||
|
|
@ -1168,7 +1157,6 @@
|
|||
<includeDependencySources>true</includeDependencySources>
|
||||
<dependencySourceIncludes>
|
||||
<dependencySourceInclude>org.apache.dubbo:dubbo-*</dependencySourceInclude>
|
||||
<dependencySourceExclude>com.alibaba:hessian-*</dependencySourceExclude>
|
||||
</dependencySourceIncludes>
|
||||
<show>public</show>
|
||||
<charset>UTF-8</charset>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.apache.dubbo.registry.kubernetes;
|
|||
import org.apache.dubbo.common.URL;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.JsonUtils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
import org.apache.dubbo.registry.client.AbstractServiceDiscovery;
|
||||
import org.apache.dubbo.registry.client.DefaultServiceInstance;
|
||||
|
|
@ -30,7 +31,6 @@ import org.apache.dubbo.registry.kubernetes.util.KubernetesConfigUtils;
|
|||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
||||
import org.apache.dubbo.rpc.model.ScopeModelUtil;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.fabric8.kubernetes.api.model.EndpointAddress;
|
||||
import io.fabric8.kubernetes.api.model.EndpointPort;
|
||||
import io.fabric8.kubernetes.api.model.EndpointSubset;
|
||||
|
|
@ -130,7 +130,7 @@ public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
|||
.edit(pod ->
|
||||
new PodBuilder(pod)
|
||||
.editOrNewMetadata()
|
||||
.addToAnnotations(KUBERNETES_PROPERTIES_KEY, JSONObject.toJSONString(serviceInstance.getMetadata()))
|
||||
.addToAnnotations(KUBERNETES_PROPERTIES_KEY, JsonUtils.getJson().toJson(serviceInstance.getMetadata()))
|
||||
.endMetadata()
|
||||
.build());
|
||||
if (logger.isInfoEnabled()) {
|
||||
|
|
@ -416,7 +416,7 @@ public class KubernetesServiceDiscovery extends AbstractServiceDiscovery {
|
|||
|
||||
String properties = pod.getMetadata().getAnnotations().get(KUBERNETES_PROPERTIES_KEY);
|
||||
if (StringUtils.isNotEmpty(properties)) {
|
||||
serviceInstance.getMetadata().putAll(JSONObject.parseObject(properties, Map.class));
|
||||
serviceInstance.getMetadata().putAll(JsonUtils.getJson().toJavaObject(properties, Map.class));
|
||||
instances.add(serviceInstance);
|
||||
} else {
|
||||
logger.warn(REGISTRY_UNABLE_FIND_SERVICE_KUBERNETES, "", "", "Unable to find Service Instance metadata in Pod Annotations. " +
|
||||
|
|
|
|||
|
|
@ -72,5 +72,10 @@
|
|||
<version>${project.parent.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import org.apache.dubbo.common.URL;
|
|||
import org.apache.dubbo.common.constants.CommonConstants;
|
||||
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
|
||||
import org.apache.dubbo.common.logger.LoggerFactory;
|
||||
import org.apache.dubbo.common.utils.JsonUtils;
|
||||
import org.apache.dubbo.common.utils.NamedThreadFactory;
|
||||
import org.apache.dubbo.common.utils.NetUtils;
|
||||
import org.apache.dubbo.common.utils.StringUtils;
|
||||
|
|
@ -37,8 +38,6 @@ import org.apache.dubbo.rpc.model.ApplicationModel;
|
|||
import org.apache.dubbo.rpc.model.ScopeModelUtil;
|
||||
import org.apache.dubbo.rpc.service.Destroyable;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -139,7 +138,7 @@ public class ReflectionBasedServiceDiscovery extends AbstractServiceDiscovery {
|
|||
}
|
||||
|
||||
private void updateInstanceMetadata(ServiceInstance serviceInstance) {
|
||||
String metadataString = JSONObject.toJSONString(serviceInstance.getMetadata());
|
||||
String metadataString = JsonUtils.getJson().toJson(serviceInstance.getMetadata());
|
||||
String metadataRevision = RevisionResolver.calRevision(metadataString);
|
||||
|
||||
// check if metadata updated
|
||||
|
|
@ -201,7 +200,7 @@ public class ReflectionBasedServiceDiscovery extends AbstractServiceDiscovery {
|
|||
// Metadata will be updated by provider callback
|
||||
|
||||
String metadataString = metadataMap.get(hostId);
|
||||
serviceInstance.setMetadata(JSONObject.parseObject(metadataString, Map.class));
|
||||
serviceInstance.setMetadata(JsonUtils.getJson().toJavaObject(metadataString, Map.class));
|
||||
} else {
|
||||
// refer from MetadataUtils, this proxy is different from the one used to refer exportedURL
|
||||
MetadataService metadataService = getMetadataServiceProxy(serviceInstance);
|
||||
|
|
@ -220,12 +219,12 @@ public class ReflectionBasedServiceDiscovery extends AbstractServiceDiscovery {
|
|||
}
|
||||
});
|
||||
metadataMap.put(hostId, metadata);
|
||||
serviceInstance.setMetadata(JSONObject.parseObject(metadata, Map.class));
|
||||
serviceInstance.setMetadata(JsonUtils.getJson().toJavaObject(metadata, Map.class));
|
||||
}
|
||||
}
|
||||
|
||||
public final void notifyListener(String serviceName, ServiceInstancesChangedListener listener, List<ServiceInstance> instances) {
|
||||
String serviceInstanceRevision = RevisionResolver.calRevision(JSONObject.toJSONString(instances));
|
||||
String serviceInstanceRevision = RevisionResolver.calRevision(JsonUtils.getJson().toJson(instances));
|
||||
boolean changed = !serviceInstanceRevision.equalsIgnoreCase(
|
||||
serviceInstanceRevisionMap.put(serviceName, serviceInstanceRevision));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue