From a79eeb02083c520b682b62f9962bc422131775e7 Mon Sep 17 00:00:00 2001 From: tanghc Date: Sat, 7 Nov 2020 14:17:28 +0800 Subject: [PATCH] 4.2.0 --- .../java/com/gitee/sop/websiteserver/bean/EurekaUri.java | 5 +++-- .../sop/websiteserver/service/impl/NacosServerService.java | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/bean/EurekaUri.java b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/bean/EurekaUri.java index 8f4b2d1b..14beaab9 100644 --- a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/bean/EurekaUri.java +++ b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/bean/EurekaUri.java @@ -5,6 +5,7 @@ import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.internal.http.HttpMethod; import org.apache.commons.lang.ArrayUtils; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMethod; /** @@ -49,13 +50,13 @@ public enum EurekaUri { } public Request getRequest(String url, String... args) { + url = StringUtils.trimTrailingCharacter(url, '/'); String requestUrl = url + getUri(args); - Request request = this.getBuilder() + return this.getBuilder() .url(requestUrl) .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .build(); - return request; } public Request.Builder getBuilder() { diff --git a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java index c2a8c8ce..6d1bd69f 100644 --- a/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java +++ b/sop-website/sop-website-server/src/main/java/com/gitee/sop/websiteserver/service/impl/NacosServerService.java @@ -1,6 +1,5 @@ package com.gitee.sop.websiteserver.service.impl; -import com.alibaba.cloud.nacos.NacosDiscoveryProperties; import com.alibaba.nacos.api.PropertyKeyConst; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingFactory; @@ -9,7 +8,6 @@ import com.alibaba.nacos.api.naming.pojo.Instance; import com.gitee.sop.websiteserver.service.ServerService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import javax.annotation.PostConstruct;