diff --git a/src/org/redkale/net/http/Rest.java b/src/org/redkale/net/http/Rest.java index f5c1eaeba..4af43e09e 100644 --- a/src/org/redkale/net/http/Rest.java +++ b/src/org/redkale/net/http/Rest.java @@ -68,7 +68,7 @@ public final class Rest { int mod = baseServletClass.getModifiers(); if (!java.lang.reflect.Modifier.isPublic(mod)) return null; if (java.lang.reflect.Modifier.isAbstract(mod)) return null; - + final String serviceDesc = Type.getDescriptor(serviceType); final String webServletDesc = Type.getDescriptor(WebServlet.class); final String reqDesc = Type.getDescriptor(HttpRequest.class); @@ -180,6 +180,7 @@ public final class Rest { if (EXCLUDERMETHODS.contains(method.getName())) continue; if ("init".equals(method.getName())) continue; if ("destroy".equals(method.getName())) continue; + if ("version".equals(method.getName())) continue; RestMapping[] mappings = method.getAnnotationsByType(RestMapping.class); boolean ignore = false; diff --git a/src/org/redkale/net/sncp/SncpClient.java b/src/org/redkale/net/sncp/SncpClient.java index 3f2142338..cd9eddb0d 100644 --- a/src/org/redkale/net/sncp/SncpClient.java +++ b/src/org/redkale/net/sncp/SncpClient.java @@ -177,6 +177,7 @@ public final class SncpClient { if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue; if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue; if (method.getName().equals("init") || method.getName().equals("destroy")) continue; + if (method.getName().equals("version") || method.getName().equals("name")) continue; //if (onlySncpDyn && method.getAnnotation(SncpDyn.class) == null) continue; DLong actionid = Sncp.hash(method); Method old = actionids.get(actionid); diff --git a/src/org/redkale/net/sncp/SncpDynServlet.java b/src/org/redkale/net/sncp/SncpDynServlet.java index 6841ef1bc..caad5eb89 100644 --- a/src/org/redkale/net/sncp/SncpDynServlet.java +++ b/src/org/redkale/net/sncp/SncpDynServlet.java @@ -62,7 +62,8 @@ public final class SncpDynServlet extends SncpServlet { if (method.getName().equals("getClass") || method.getName().equals("toString")) continue; if (method.getName().equals("equals") || method.getName().equals("hashCode")) continue; if (method.getName().equals("notify") || method.getName().equals("notifyAll") || method.getName().equals("wait")) continue; - if (method.getName().equals("init") || method.getName().equals("destroy") || method.getName().equals("name")) continue; + if (method.getName().equals("init") || method.getName().equals("destroy")) continue; + if (method.getName().equals("version") || method.getName().equals("name")) continue; final DLong actionid = Sncp.hash(method); SncpServletAction action = SncpServletAction.create(service, actionid, method); action.convert = convert; @@ -182,9 +183,9 @@ public final class SncpDynServlet extends SncpServlet { * } * * - * @param service Service + * @param service Service * @param actionid 操作ID - * @param method 方法 + * @param method 方法 * * @return SncpServletAction */ diff --git a/src/org/redkale/service/Service.java b/src/org/redkale/service/Service.java index 83591fd1b..ea5e314e6 100644 --- a/src/org/redkale/service/Service.java +++ b/src/org/redkale/service/Service.java @@ -10,7 +10,7 @@ import org.redkale.util.*; /** * 所有Service的实现类不得声明为final, 允许远程模式的public方法都不能声明为final。 * 注意: "$"是一个很特殊的Service.name值 。 被标记为@Resource(name = "$") 的Service的资源名与所属父Service的资源名一致。 - * + * *
- * + * ** Service的资源类型 * 业务逻辑的Service通常有两种编写方式: @@ -18,7 +18,7 @@ import org.redkale.util.*; * 2、先定义业务的Service接口或抽象类,再编写具体实现类。 * 第二种方式需要在具体实现类上使用@ResourceType指明资源注入的类型。 *
* 详情见: http://redkale.org * @@ -44,4 +44,14 @@ public interface Service { } + /** + * Service的接口版本号 + * 注: public方法的参数或返回类型或参数类型内部变更后改值必须进行改变 + * + * @return 接口版本号 + */ + default int version() { + return 0; + } + }