Direct Connection Provider
This document is no longer maintained. You are currently viewing a snapshot version. If you want to view the latest version of the documentation, see Latest Version.
In the development and testing environment, it is often necessary to bypass the registration center and only test the specified service provider. At this time, point-to-point direct connection may be required. The point-to-point direct connection method will use the service interface as the unit and ignore the provider list of the registration center. A The point-to-point interface configuration does not affect the B interface to obtain the list from the registration center.
Configuration via XML
If the online demand needs point-to-point, you can configure the url to point to the provider in <dubbo:reference>
, which will bypass the registration center. Multiple addresses are separated by semicolons, and the configuration is as follows:
<dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />
Prompt
1.0.6
and above version supportSpecified by -D parameter
Add the -D parameter mapping service address to the JVM startup parameters, such as:
java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890
Prompt
The key is the service name, and the value is the service provider url. This configuration has the highest priority and is supported by1.0.15
and above versionsBy file mapping
If there are many services, you can also use file mapping, use -Ddubbo.resolve.file
to specify the mapping file path, this configuration has a higher priority than the configuration [^3] in <dubbo:reference>
, such as:
java -Ddubbo.resolve.file=xxx.properties
Then add the configuration to the mapping file xxx.properties
, where the key is the service name and the value is the service provider URL:
com.alibaba.xxx.XxxService=dubbo://localhost:20890
Prompt
1.0.15
and above versions support, 2.0
and above versions automatically load the ${user.home}/dubbo-resolve.properties file, no configuration required