解决方案
QoS参数可以通过如下方式进行配置
<?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://dubbo.apache.org/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://dubbo.apache.org/schema/dubbo http://dubbo.apache.org/schema/dubbo/dubbo.xsd"> <dubbo:application name="demo-provider"> <dubbo:parameter key="qos.enable" value="true"/> <dubbo:parameter key="qos.accept.foreign.ip" value="false"/> <dubbo:parameter key="qos.port" value="33333"/> </dubbo:application> <dubbo:registry address="multicast://224.5.6.7:1234"/> <dubbo:protocol name="dubbo" port="20880"/> <dubbo:service interface="org.apache.dubbo.demo.provider.DemoService" ref="demoService"/> <bean id="demoService" class="org.apache.dubbo.demo.provider.DemoServiceImpl"/> </beans>
其中,上述方式的优先顺序为系统属性 > dubbo.properties > XML/Spring-boot自动装配方式。
注意:网上说的配置不生效的原因,如果你是使用dubbo.properties 配置端口配置为:dubbo.application.qos.port=33333
如果使用的是spring配置文件,则配置方式为:dubbo.application.qosPort=33333
原文:https://www.cnblogs.com/sanmingzi999/p/13958813.html