In development and testing environments, it is often necessary to bypass the registry and only test specific service providers. In this case, point-to-point direct connection may be required. The point-to-point direct connection method will ignore the provider list from the registry on a service interface basis. Configuring point-to-point for interface A will not affect interface B from obtaining the list from the registry.
If point-to-point communication is needed in a production environment, you can configure the reference
node to point to the provider URL, bypassing the registry. Multiple addresses can be separated by semicolons, configured as follows:
@DubboReference(url="tri://localhost:50051")
private XxxService xxxService
<dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />
Add the -D parameter to the JVM startup parameters to map the service address, such as:
java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890
1.0.15
and above.If there are many services, you can also use file mapping by specifying the mapping file path with -Ddubbo.resolve.file
, which has a higher priority than the configuration in <dubbo:reference>
[^3], such as:
java -Ddubbo.resolve.file=xxx.properties
Then add the configuration in 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
1.0.15
and above. Version 2.0
and higher automatically loads the ${user.home}/dubbo-resolve.properties file without needing configuration.