
# 静态目标服务
#### 方案介绍
通过[dubbo:reference](https://dubbo.apache.org/zh/docs/references/xml/dubbo-reference/)在Dubbo服务的服务消费者中对引用的服务提供者进行配置。使用选项url定义点对点直连服务提供者地址，绕过注册中心，直接调用目标服务。
#### 详细说明
如果原Dubbo服务中使用的是xml配置文件，则只需要修改配置文件即可。
```
<?xml version="1.0" encoding="UTF-8"?>
<beans>
    <!-- 提供哪些接口给消费者调用 -->
    <dubbo:reference id="helloService " interface="com.dubbo.service.HelloService " url = "dubbo://helloService:20880" />
</beans>
```
如果服务中使用注解的方式来定义引用的目标服务，则需要修改代码中对目标服务的注解。
```
@Reference(url = "dubbo://helloService:20880")
HelloService helloService;
```
