feat():修复forest请求nacospi接口为路径参数的问题
parent
4a20aea3b3
commit
e3c47cd1a3
|
@ -13,12 +13,12 @@ import com.muyu.common.nacos.remote.resp.ServiceListResp;
|
|||
* nacos服务api
|
||||
*/
|
||||
@BaseRequest(
|
||||
baseURL = Constants.HTTP+"#{nacos.addr}/nacos/v1/ns/service",
|
||||
interceptor = {NacosNamespaceInterceptor.class}
|
||||
baseURL = Constants.HTTP+"#{nacos.addr}/nacos/v1/ns/service"
|
||||
)
|
||||
public interface NacosServiceRemote {
|
||||
@GetRequest(
|
||||
url = "/list"
|
||||
url = "/list",
|
||||
interceptor = {NacosNamespaceInterceptor.class}
|
||||
)
|
||||
public ServiceListResp serviceList(@Query ServiceListReq serviceListReq);
|
||||
}
|
||||
|
|
|
@ -23,11 +23,11 @@ public class NacosNamespaceInterceptor<T> implements Interceptor<T> {
|
|||
if (StringUtils.isNotEmpty(namespaceId)) {
|
||||
String reqNamespaceId = Convert.utf8Str(req.getQuery("namespaceId"));
|
||||
if (reqNamespaceId == null){
|
||||
log.warn("本次请求nacos的namespaceId未携带,已添加[{}]",namespaceId);
|
||||
log.warn("本次请求nacos的namespaceId未携带,已添加[{}]",reqNamespaceId,namespaceId);
|
||||
req.addQuery("namespaceId", namespaceId);
|
||||
}else {
|
||||
if (StringUtils.equals(reqNamespaceId,namespaceId)){
|
||||
log.warn("本次请求nacos的namespaceId与和项目ID不相符,现已更改:[{}->{}]",namespaceId);
|
||||
log.warn("本次请求nacos的namespaceId与和项目ID不相符,现已更改:[{}->{}]",reqNamespaceId,namespaceId);
|
||||
req.addQuery("namespaceId", namespaceId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.common.nacos.remote.req.ServiceListReq;
|
|||
import com.muyu.common.nacos.remote.resp.ServiceListResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,6 +28,7 @@ public class NacosService {
|
|||
.pageSize(pageSize)
|
||||
.build()
|
||||
);
|
||||
serverList.addAll(serviceListResp.getDoms());
|
||||
}while (serviceListResp.getCount() > pageNo * pageSize);
|
||||
|
||||
return serverList;
|
||||
|
|
Loading…
Reference in New Issue