mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
RouteInterceptorContext可获转发的目标微服务信息
This commit is contained in:
@@ -3,6 +3,7 @@ package com.gitee.sop.gateway.interceptor;
|
||||
import com.gitee.sop.gatewaycommon.interceptor.RouteInterceptor;
|
||||
import com.gitee.sop.gatewaycommon.interceptor.RouteInterceptorContext;
|
||||
import com.gitee.sop.gatewaycommon.param.ApiParam;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -21,7 +22,9 @@ public class MyRouteInterceptor implements RouteInterceptor {
|
||||
|
||||
@Override
|
||||
public void afterRoute(RouteInterceptorContext context) {
|
||||
System.out.println("请求成功,微服务返回结果:" + context.getServiceResult());
|
||||
ServiceInstance serviceInstance = context.getServiceInstance();
|
||||
System.out.println("请求成功,serviceId:" + serviceInstance.getServiceId() + "(" + serviceInstance.getHost() + ":" + serviceInstance.getPort() + ")" +
|
||||
",微服务返回结果:" + context.getServiceResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user