This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.1
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.1 by this push:
     new bf11f298ed feat: add mesh enable config and process url in mesh mode 
(#10356)
bf11f298ed is described below

commit bf11f298edfebf7405dd5fc850a22f3c13a99a07
Author: conghuhu <[email protected]>
AuthorDate: Tue Aug 9 21:39:25 2022 +0800

    feat: add mesh enable config and process url in mesh mode (#10356)
---
 .../dubbo/common/constants/CommonConstants.java    |  22 +++++
 .../dubbo/common/constants/RegistryConstants.java  |   7 ++
 .../dubbo/config/AbstractReferenceConfig.java      |  23 ++++-
 .../org/apache/dubbo/config/ConsumerConfig.java    |  16 ++++
 .../dubbo/config/annotation/DubboReference.java    |  22 ++++-
 .../org/apache/dubbo/config/ReferenceConfig.java   | 102 ++++++++++++++++++---
 .../spring/reference/ReferenceAttributes.java      |   2 +
 .../spring/reference/ReferenceBeanBuilder.java     |   5 +
 .../src/main/resources/META-INF/compat/dubbo.xsd   |  11 +++
 .../src/main/resources/META-INF/dubbo.xsd          |  11 +++
 10 files changed, 200 insertions(+), 21 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
index 2939eb352c..a238e7d439 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
@@ -546,4 +546,26 @@ public interface CommonConstants {
 
     String PREFER_JSON_FRAMEWORK_NAME = "dubbo.json-framework.prefer";
 
+    /**
+     * @since 3.1.0
+     */
+    String MESH_ENABLE = "mesh-enable";
+
+    /**
+     * @since 3.1.0
+     */
+    Integer DEFAULT_MESH_PORT = 80;
+
+    /**
+     * @since 3.1.0
+     */
+    String SVC = ".svc.";
+
+    /**
+     * Domain name suffix used inside k8s.
+     *
+     * @since 3.1.0
+     */
+    String DEFAULT_CLUSTER_DOMAIN = "cluster.local";
+
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java
index 0e4f0938be..622780a79a 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java
@@ -102,6 +102,13 @@ public interface RegistryConstants {
 
     String PROVIDED_BY = "provided-by";
 
+    /**
+     * The provider tri port
+     *
+     * @since 3.1.0
+     */
+    String PROVIDER_PORT = "provider-port";
+
     /**
      * The request size of service instances
      *
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
index dcada0ce1d..f557f93552 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java
@@ -27,6 +27,7 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.REFER_ASYNC_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.ROUTER_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.STUB_EVENT_KEY;
 import static org.apache.dubbo.common.constants.RegistryConstants.PROVIDED_BY;
+import static 
org.apache.dubbo.common.constants.RegistryConstants.PROVIDER_PORT;
 
 /**
  * AbstractConsumerConfig
@@ -76,18 +77,26 @@ public abstract class AbstractReferenceConfig extends 
AbstractInterfaceConfig {
     protected Boolean stubevent;//= Constants.DEFAULT_STUB_EVENT;
 
 
-
     /**
      * declares which app or service this interface belongs to
      */
     protected String providedBy;
 
+    /**
+     * By VirtualService and DestinationRule, envoy will generate a new route 
rule,such as 'demo.default.svc.cluster.local:80',the default port is 80.
+     * When you want to specify the provider port,you can use this config.
+     *
+     * @since 3.1.0
+     */
+    protected Integer providerPort;
+
     protected String router;
 
     /**
      * Weather the reference is referred asynchronously
-     * @deprecated
+     *
      * @see ModuleConfig#referAsync
+     * @deprecated
      */
     @Deprecated
     private Boolean referAsync;
@@ -248,7 +257,6 @@ public abstract class AbstractReferenceConfig extends 
AbstractInterfaceConfig {
     }
 
 
-
     @Parameter(key = PROVIDED_BY)
     public String getProvidedBy() {
         return providedBy;
@@ -258,6 +266,15 @@ public abstract class AbstractReferenceConfig extends 
AbstractInterfaceConfig {
         this.providedBy = providedBy;
     }
 
+    @Parameter(key = PROVIDER_PORT)
+    public Integer getProviderPort() {
+        return providerPort;
+    }
+
+    public void setProviderPort(Integer providerPort) {
+        this.providerPort = providerPort;
+    }
+
     @Parameter(key = ROUTER_KEY, append = true)
     public String getRouter() {
         return router;
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/ConsumerConfig.java 
b/dubbo-common/src/main/java/org/apache/dubbo/config/ConsumerConfig.java
index a3c3726e6c..10faac7015 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/config/ConsumerConfig.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/config/ConsumerConfig.java
@@ -20,6 +20,7 @@ import org.apache.dubbo.common.utils.StringUtils;
 import org.apache.dubbo.config.support.Parameter;
 import org.apache.dubbo.rpc.model.ModuleModel;
 
+import static org.apache.dubbo.common.constants.CommonConstants.MESH_ENABLE;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REFER_BACKGROUND_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.REFER_THREAD_NUM_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.URL_MERGE_PROCESSOR_KEY;
@@ -78,6 +79,12 @@ public class ConsumerConfig extends AbstractReferenceConfig {
      */
     private Boolean referBackground;
 
+    /**
+     * enable mesh mode
+     * @since 3.1.0
+     */
+    private Boolean meshEnable;
+
 
     public ConsumerConfig() {
     }
@@ -170,4 +177,13 @@ public class ConsumerConfig extends 
AbstractReferenceConfig {
     public void setReferBackground(Boolean referBackground) {
         this.referBackground = referBackground;
     }
+
+    @Parameter(key = MESH_ENABLE)
+    public Boolean getMeshEnable() {
+        return meshEnable;
+    }
+
+    public void setMeshEnable(Boolean meshEnable) {
+        this.meshEnable = meshEnable;
+    }
 }
diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/config/annotation/DubboReference.java
 
b/dubbo-common/src/main/java/org/apache/dubbo/config/annotation/DubboReference.java
index 6b5c215034..e33797e9b1 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/config/annotation/DubboReference.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/config/annotation/DubboReference.java
@@ -19,6 +19,7 @@ package org.apache.dubbo.config.annotation;
 import org.apache.dubbo.common.constants.ClusterRules;
 import org.apache.dubbo.common.constants.LoadbalanceRules;
 import org.apache.dubbo.common.constants.RegistryConstants;
+import org.apache.dubbo.config.AbstractReferenceConfig;
 import org.apache.dubbo.config.ReferenceConfigBase;
 
 import java.lang.annotation.Documented;
@@ -32,7 +33,7 @@ import java.lang.annotation.Target;
  * <p>
  * <b>It is recommended to use @DubboReference on the @Bean method in the 
Java-config class, but not on the fields or setter methods to be injected.</b>
  * </p>
- *
+ * <p>
  * Step 1: Register ReferenceBean in Java-config class:
  * <pre class="code">
  * &#64;Configuration
@@ -50,7 +51,7 @@ import java.lang.annotation.Target;
  *     }
  * }
  * </pre>
- *
+ * <p>
  * Step 2: Inject ReferenceBean by @Autowired
  * <pre class="code">
  * public class FooController {
@@ -62,9 +63,9 @@ import java.lang.annotation.Target;
  * }
  * </pre>
  *
- * @since 2.7.7
  * @see org.apache.dubbo.config.spring.reference.ReferenceBeanBuilder
  * @see org.apache.dubbo.config.spring.ReferenceBean
+ * @since 2.7.7
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
@@ -103,6 +104,7 @@ public @interface DubboReference {
 
     /**
      * Whether to enable generic invocation, default value is false
+     *
      * @deprecated Do not need specify generic value, judge by injection type 
and interface class
      */
     @Deprecated
@@ -110,6 +112,7 @@ public @interface DubboReference {
 
     /**
      * When enable, prefer to call local service in the same JVM if it's 
present, default value is true
+     *
      * @deprecated using scope="local" or scope="remote" instead
      */
     @Deprecated
@@ -122,6 +125,7 @@ public @interface DubboReference {
 
     /**
      * Whether eager initialize the reference bean when all properties are 
set, default value is true ( null as true)
+     *
      * @see ReferenceConfigBase#shouldInit()
      */
     boolean init() default true;
@@ -270,6 +274,7 @@ public @interface DubboReference {
 
     /**
      * Application name
+     *
      * @deprecated This attribute was deprecated, use bind application/module 
of spring ApplicationContext
      */
     @Deprecated
@@ -321,6 +326,7 @@ public @interface DubboReference {
     /**
      * The id
      * NOTE: The id attribute is ignored when using @DubboReference on @Bean 
method
+     *
      * @return default value is empty
      * @since 2.7.3
      */
@@ -337,12 +343,22 @@ public @interface DubboReference {
 
     /**
      * declares which app or service this interface belongs to
+     *
      * @see RegistryConstants#PROVIDED_BY
      */
     String[] providedBy() default {};
 
+    /**
+     * The service port of the provider
+     *
+     * @see AbstractReferenceConfig#providerPort
+     * @since 3.1.0
+     */
+    int providerPort() default -1;
+
     /**
      * the scope for referring/exporting a service, if it's local, it means 
searching in current JVM only.
+     *
      * @see org.apache.dubbo.rpc.Constants#SCOPE_LOCAL
      * @see org.apache.dubbo.rpc.Constants#SCOPE_REMOTE
      */
diff --git 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
index 40f7641854..19d278329f 100644
--- 
a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
+++ 
b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
@@ -59,6 +59,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.Callable;
 
@@ -67,14 +68,20 @@ import static 
org.apache.dubbo.common.constants.CommonConstants.CLUSTER_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR;
 import static 
org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR_CHAR;
 import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
+import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_CLUSTER_DOMAIN;
+import static 
org.apache.dubbo.common.constants.CommonConstants.DEFAULT_MESH_PORT;
 import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.LOCALHOST_VALUE;
+import static org.apache.dubbo.common.constants.CommonConstants.MESH_ENABLE;
 import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.PROXY_CLASS_REF;
 import static org.apache.dubbo.common.constants.CommonConstants.REVISION_KEY;
 import static 
org.apache.dubbo.common.constants.CommonConstants.SEMICOLON_SPLIT_PATTERN;
 import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.SVC;
+import static org.apache.dubbo.common.constants.CommonConstants.TRIPLE;
+import static org.apache.dubbo.common.constants.RegistryConstants.PROVIDED_BY;
 import static 
org.apache.dubbo.common.constants.RegistryConstants.SUBSCRIBED_SERVICE_NAMES_KEY;
 import static org.apache.dubbo.common.utils.NetUtils.isInvalidLocalHost;
 import static org.apache.dubbo.common.utils.StringUtils.splitToSet;
@@ -248,7 +255,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
     }
 
     protected synchronized void init() {
-        if (initialized && ref !=null ) {
+        if (initialized && ref != null) {
             return;
         }
         try {
@@ -276,7 +283,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                 serviceDescriptor = repository.registerService(interfaceClass);
             }
             consumerModel = new ConsumerModel(serviceMetadata.getServiceKey(), 
proxy, serviceDescriptor,
-                getScopeModel(), serviceMetadata, createAsyncMethodInfo(), 
interfaceClassLoader);
+                    getScopeModel(), serviceMetadata, createAsyncMethodInfo(), 
interfaceClassLoader);
 
             // Compatible with dependencies on 
ServiceModel#getReferenceConfig() , and will be removed in a future version.
             consumerModel.setConfig(this);
@@ -392,7 +399,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
             hostToRegistry = NetUtils.getLocalHost();
         } else if (isInvalidLocalHost(hostToRegistry)) {
             throw new IllegalArgumentException(
-                "Specified invalid registry ip from property:" + 
DUBBO_IP_TO_REGISTRY + ", value:" + hostToRegistry);
+                    "Specified invalid registry ip from property:" + 
DUBBO_IP_TO_REGISTRY + ", value:" + hostToRegistry);
         }
 
         map.put(REGISTER_IP_KEY, hostToRegistry);
@@ -419,6 +426,9 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
             createInvokerForLocal(referenceParameters);
         } else {
             urls.clear();
+
+            meshModeHandleUrl(referenceParameters);
+
             if (StringUtils.isNotEmpty(url)) {
                 // user specified URL, could be peer-to-peer address, or 
register center's address.
                 parseUrl(referenceParameters);
@@ -433,12 +443,12 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
 
         if (logger.isInfoEnabled()) {
             logger.info("Referred dubbo service: [" + 
referenceParameters.get(INTERFACE_KEY) + "]." +
-                (Boolean.parseBoolean(referenceParameters.get(GENERIC_KEY)) ?
-                    " it's GenericService reference" : " it's not 
GenericService reference"));
+                    
(Boolean.parseBoolean(referenceParameters.get(GENERIC_KEY)) ?
+                            " it's GenericService reference" : " it's not 
GenericService reference"));
         }
 
         URL consumerUrl = new ServiceConfigURL(CONSUMER_PROTOCOL, 
referenceParameters.get(REGISTER_IP_KEY), 0,
-            referenceParameters.get(INTERFACE_KEY), referenceParameters);
+                referenceParameters.get(INTERFACE_KEY), referenceParameters);
         consumerUrl = consumerUrl.setScopeModel(getScopeModel());
         consumerUrl = consumerUrl.setServiceModel(consumerModel);
         MetadataUtils.publishServiceDefinition(consumerUrl, 
consumerModel.getServiceModel(), getApplicationModel());
@@ -447,6 +457,68 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
         return (T) proxyFactory.getProxy(invoker, 
ProtocolUtils.isGeneric(generic));
     }
 
+    /**
+     * if enable mesh mode, handle url.
+     *
+     * @param referenceParameters referenceParameters
+     */
+    private void meshModeHandleUrl(Map<String, String> referenceParameters) {
+        if (!checkMeshConfig(referenceParameters)) {
+            return;
+        }
+        if (StringUtils.isNotEmpty(url)) {
+            // user specified URL, could be peer-to-peer address, or register 
center's address.
+            if (logger.isInfoEnabled()) {
+                logger.info("The url already exists, mesh no longer processes 
url: " + url);
+            }
+            return;
+        }
+        // get pod namespace
+        String podNamespace;
+        if (StringUtils.isEmpty(System.getenv("POD_NAMESPACE"))) {
+            if (logger.isWarnEnabled()) {
+                logger.warn("Can not get env variable: POD_NAMESPACE, it may 
not be running in the K8S environment , " +
+                        "finally use 'default' replace");
+            }
+            podNamespace = "default";
+        } else {
+            podNamespace = System.getenv("POD_NAMESPACE");
+        }
+
+        // In mesh mode, providedBy equals K8S Service name.
+        String providedBy = referenceParameters.get(PROVIDED_BY);
+        // cluster_domain default is 'cluster.local',generally unchanged.
+        String clusterDomain = 
Optional.ofNullable(System.getenv("CLUSTER_DOMAIN")).orElse(DEFAULT_CLUSTER_DOMAIN);
+        // By VirtualService and DestinationRule, envoy will generate a new 
route rule,such as 'demo.default.svc.cluster.local:80',the default port is 80.
+        Integer meshPort = 
Optional.ofNullable(getProviderPort()).orElse(DEFAULT_MESH_PORT);
+        // DubboReference default is -1, process it.
+        meshPort = meshPort > -1 ? meshPort : DEFAULT_MESH_PORT;
+        // get mesh url.
+        url = TRIPLE + "://" + providedBy + "." + podNamespace + SVC + 
clusterDomain + ":" + meshPort;
+    }
+
+    /**
+     * check if mesh config is correct
+     *
+     * @param referenceParameters referenceParameters
+     * @return mesh config is correct
+     */
+    private boolean checkMeshConfig(Map<String, String> referenceParameters) {
+        if (!"true".equals(referenceParameters.getOrDefault(MESH_ENABLE, 
"false"))) {
+            return false;
+        }
+
+        getScopeModel().getConfigManager().getProtocol(TRIPLE)
+                .orElseThrow(() -> new IllegalStateException("In mesh mode, a 
triple protocol must be specified"));
+
+        String providedBy = referenceParameters.get(PROVIDED_BY);
+        if (StringUtils.isEmpty(providedBy)) {
+            throw new IllegalStateException("In mesh mode, the providedBy of 
ReferenceConfig is must be set");
+        }
+
+        return true;
+    }
+
     /**
      * Make a local reference, create a local invoker.
      *
@@ -511,9 +583,9 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
         }
         if (urls.isEmpty()) {
             throw new IllegalStateException(
-                "No such any registry to reference " + interfaceName + " on 
the consumer " + NetUtils.getLocalHost() +
-                    " use dubbo version " + Version.getVersion() +
-                    ", please config <dubbo:registry address=\"...\" /> to 
your spring config.");
+                    "No such any registry to reference " + interfaceName + " 
on the consumer " + NetUtils.getLocalHost() +
+                            " use dubbo version " + Version.getVersion() +
+                            ", please config <dubbo:registry address=\"...\" 
/> to your spring config.");
         }
     }
 
@@ -593,7 +665,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
 
         // init some null configuration.
         List<ConfigInitializer> configInitializers = 
this.getExtensionLoader(ConfigInitializer.class)
-            .getActivateExtension(URL.valueOf("configInitializer://"), 
(String[]) null);
+                .getActivateExtension(URL.valueOf("configInitializer://"), 
(String[]) null);
         configInitializers.forEach(e -> e.initReferConfig(this));
 
         if (getGeneric() == null && getConsumer() != null) {
@@ -602,9 +674,9 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
         if (ProtocolUtils.isGeneric(generic)) {
             if (interfaceClass != null && 
!interfaceClass.equals(GenericService.class)) {
                 logger.warn(String.format("Found conflicting attributes for 
interface type: [interfaceClass=%s] and [generic=%s], " +
-                        "because the 'generic' attribute has higher priority 
than 'interfaceClass', so change 'interfaceClass' to '%s'. " +
-                        "Note: it will make this reference bean as a candidate 
bean of type '%s' instead of '%s' when resolving dependency in Spring.",
-                    interfaceClass.getName(), generic, 
GenericService.class.getName(), GenericService.class.getName(), 
interfaceClass.getName()));
+                                "because the 'generic' attribute has higher 
priority than 'interfaceClass', so change 'interfaceClass' to '%s'. " +
+                                "Note: it will make this reference bean as a 
candidate bean of type '%s' instead of '%s' when resolving dependency in 
Spring.",
+                        interfaceClass.getName(), generic, 
GenericService.class.getName(), GenericService.class.getName(), 
interfaceClass.getName()));
             }
             interfaceClass = GenericService.class;
         } else {
@@ -613,7 +685,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
                     interfaceClass = Class.forName(interfaceName, true, 
getInterfaceClassLoader());
                 } else if (interfaceClass == null) {
                     interfaceClass = Class.forName(interfaceName, true, 
Thread.currentThread()
-                        .getContextClassLoader());
+                            .getContextClassLoader());
                 }
             } catch (ClassNotFoundException e) {
                 throw new IllegalStateException(e.getMessage(), e);
@@ -670,7 +742,7 @@ public class ReferenceConfig<T> extends 
ReferenceConfigBase<T> {
 
     private void postProcessConfig() {
         List<ConfigPostProcessor> configPostProcessors = 
this.getExtensionLoader(ConfigPostProcessor.class)
-            .getActivateExtension(URL.valueOf("configPostProcessor://"), 
(String[]) null);
+                .getActivateExtension(URL.valueOf("configPostProcessor://"), 
(String[]) null);
         configPostProcessors.forEach(component -> 
component.postProcessReferConfig(this));
     }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceAttributes.java
 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceAttributes.java
index 7a2d0bee89..efc13f9833 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceAttributes.java
+++ 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceAttributes.java
@@ -52,6 +52,8 @@ public interface ReferenceAttributes {
 
     String PROVIDED_BY = "providedBy";
 
+    String PROVIDER_PORT = "providerPort";
+
     String URL = "url";
 
     String CLIENT = "client";
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanBuilder.java
 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanBuilder.java
index 775d879680..36c7418031 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanBuilder.java
+++ 
b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/reference/ReferenceBeanBuilder.java
@@ -198,6 +198,11 @@ public class ReferenceBeanBuilder {
         return this;
     }
 
+    public ReferenceBeanBuilder setProviderPort(Integer providerPort) {
+        attributes.put(ReferenceAttributes.PROVIDER_PORT, providerPort);
+        return this;
+    }
+
 //    public ReferenceBeanBuilder setRouter(String router) {
 //        attributes.put(ReferenceAttributes.ROUTER, router);
 //        return this;
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd 
b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd
index b22bd916d2..ed55e23fb4 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd
+++ 
b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/compat/dubbo.xsd
@@ -239,6 +239,12 @@
                             <![CDATA[ declares which app or service this 
interface belongs to. ]]></xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
+                <xsd:attribute name="provider-port" type="xsd:integer">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            <![CDATA[ declares provider service port. 
]]></xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
                 <xsd:attribute name="router" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
@@ -1017,6 +1023,11 @@
                         <xsd:documentation><![CDATA[ The thread pool queue 
size. ]]></xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
+                <xsd:attribute name="mesh-enable" type="xsd:boolean">
+                    <xsd:annotation>
+                        <xsd:documentation><![CDATA[ Enable mesh mode. 
]]></xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
                 <xsd:anyAttribute namespace="##other" processContents="lax"/>
             </xsd:extension>
         </xsd:complexContent>
diff --git 
a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd 
b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
index 9a9a6a746a..f2a38c4a9a 100644
--- a/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
+++ b/dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd
@@ -239,6 +239,12 @@
                             <![CDATA[ declares which app or service this 
interface belongs to. ]]></xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
+                <xsd:attribute name="provider-port" type="xsd:integer">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            <![CDATA[ declares provider service port. 
]]></xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
                 <xsd:attribute name="router" type="xsd:string">
                     <xsd:annotation>
                         <xsd:documentation>
@@ -1180,6 +1186,11 @@
                             <![CDATA[ Whether refer should run in background 
or not, default false. ]]></xsd:documentation>
                     </xsd:annotation>
                 </xsd:attribute>
+                <xsd:attribute name="mesh-enable" type="xsd:boolean">
+                    <xsd:annotation>
+                        <xsd:documentation><![CDATA[ Enable mesh mode. 
]]></xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
                 <xsd:anyAttribute namespace="##other" processContents="lax"/>
             </xsd:extension>
         </xsd:complexContent>

Reply via email to