From e9b4649d71871c70d98c009442485bfe56db7caf Mon Sep 17 00:00:00 2001 From: yest Date: Wed, 20 May 2020 17:01:35 +0800 Subject: [PATCH 1/2] update README.md --- README.md | 8 +++++--- README.zh.md | 7 ++++++- pom.xml | 2 +- .../kong/caller/balancer/LoadBalancerRegistration.java | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9d559d1..1508351 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +

EN | 中文

+ # Kong-client - A light weight java sdk for fast integrating with kong ![](https://img.shields.io/badge/license-Apache%202.0-blue) @@ -34,8 +36,6 @@ API gateway The strategy will take advantage of all spring features,like intercepters,view resolvers,and complex request handlers etc. kong-client will only be acted as a request proxy and do nothing invasive in request process. -Note that, - # Usage ### Config @@ -58,6 +58,8 @@ kong.config.server.proxy.strategy # healthcheck config, required kong.config.server.healthcheck.config +# auto resolve ip from net interfaces ,default :on +kong.config.server.address.resolve ``` These config items would be specified if current app want to provide services to kong. @@ -96,7 +98,7 @@ Note that, if the app is only be a consumer of services but not a provider when com.taofen8.mid kong-client - 0.2.0-RELEASE + 0.2.1-RELEASE ``` diff --git a/README.zh.md b/README.zh.md index 120a7c1..a514e65 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,3 +1,5 @@ +

中文 | EN

+ # Kong-client - A light weight java client tools for fast integrating with kong ![](https://img.shields.io/badge/license-Apache%202.0-blue) @@ -64,6 +66,9 @@ kong.config.server.proxy.strategy # 健康检查配置,可选 kong.config.server.healthcheck.config +# 是否自动解析网卡ip,默认为on,upstream注册时首先会检查环境变量中是否指定了HOST_IP、HOST_PORT等参数,若未指定,则解析所有网卡,按照一定排序规则选择一个合适的ip用来注册, +若此开关为off,则只从环境变量中加载,没有设置则抛出异常 +kong.config.server.address.resolve ``` @@ -86,7 +91,7 @@ kong.config.caller.keyauth.keyname com.taofen8.mid kong-client - 0.2.0-RELEASE + 0.2.1-RELEASE ``` diff --git a/pom.xml b/pom.xml index f371542..1725ca6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.taofen8.mid kong-client - 0.2.0-RELEASE + 0.2.1-RELEASE jar kong-client diff --git a/src/main/java/com/taofen8/mid/kong/caller/balancer/LoadBalancerRegistration.java b/src/main/java/com/taofen8/mid/kong/caller/balancer/LoadBalancerRegistration.java index a220863..f5f56cc 100644 --- a/src/main/java/com/taofen8/mid/kong/caller/balancer/LoadBalancerRegistration.java +++ b/src/main/java/com/taofen8/mid/kong/caller/balancer/LoadBalancerRegistration.java @@ -110,7 +110,7 @@ public void setServer(KongServer server) { @Override public void run() { - while (isStop()) { + while(!stop) { boolean isAlive = LoadBalancerRegistration.isAlive(server.toString()); if (server.isAlive() != isAlive) { for (LoadBalancer balancer : balancers) { From efad6c0093dacbe2916d03313cd56cf4c8119d42 Mon Sep 17 00:00:00 2001 From: yuancd Date: Fri, 12 Jun 2020 18:00:58 +0800 Subject: [PATCH 2/2] to support get annotation from CGlib proxy bean --- .../mid/kong/register/internal/KongMappingRegistration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/taofen8/mid/kong/register/internal/KongMappingRegistration.java b/src/main/java/com/taofen8/mid/kong/register/internal/KongMappingRegistration.java index 927900b..370f786 100644 --- a/src/main/java/com/taofen8/mid/kong/register/internal/KongMappingRegistration.java +++ b/src/main/java/com/taofen8/mid/kong/register/internal/KongMappingRegistration.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; +import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; public class KongMappingRegistration extends AbstractServiceRegistration { @@ -75,7 +76,8 @@ private void collectServicesFromContext(ApplicationContext context, Config confi } if (bean != null) { - Method[] methods = bean.getClass().getDeclaredMethods(); + Class userClass = ClassUtils.getUserClass(bean); + Method[] methods = userClass.getDeclaredMethods(); for (Method method : methods) { if (method.getParameterTypes().length != 1) { continue;