dubbo常见有关问题-使用多个进程启动服务,端口冲突怎么处理
dubbo常见问题--使用多个进程启动服务,端口冲突怎么办?
使用多个进程启动服务,端口冲突怎么办?
注:此为Spring的标准功能,仅在此提示使用方式,不属于Dubbo范畴。
使用Spring自带的PropertyPlaceholderConfigurer的SYSTEM_PROPERTIES_MODE_OVERRIDE实现通过-D参数设置端口:
java -Ddubbo.service.server.port=20881 |
<? xml version = "1.0" encoding = "UTF-8" ?>
< beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo = "http://repo.alibaba-inc.com/schema/dubbo"
xsi:schemaLocation = "http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://repo.alibaba-inc.com/schema/dubbohttp://repo.alibaba-inc.com/schema/dubbo/dubbo-component.xsd" >
<!-- 使用Spring自带的占位符替换功能 -->
< bean class = "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
<!-- 系统-D参数覆盖 -->
< property name = "systemPropertiesModeName" value = "SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<!-- 指定properties配置所在位置 -->
< property name = "location" value = "classpath:xxx.properties" />
</ bean >
<!-- 使用${}引用配置项 -->
< dubbo:provider port = "${dubbo.service.server.port}" />
</ beans >
|