第2.1.9章 WEB系统最佳实践Spring文件配置之spring-dubbo.xml

公孙俊弼
2023-12-01

spring-dubbo.xml是结合阿里的Dubbo配置做服务治理,将系统接口托管给Zookeeper,实现RMI调用的方式.

<?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://code.alibabatech.com/schema/dubbo"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
	http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">

	<dubbo:application name="${domain}" owner="${dubbo.owner}"
		organization="${dubbo.organization}" />

	<!-- 使用zookeeper注册中心暴露服务地址 -->
	<dubbo:registry address="${dubbo.registry.address}" />

	<!-- 端口号,默认为20880 -->
	<dubbo:protocol name="dubbo" port="${dubbo.protocol}" />

	<!--统计服务的调用次调和调用时间的监控中心 -->
	<!-- <dubbo:monitor protocol="registry"/> -->

	<!-- 要暴露的服务接口 -->
	<dubbo:service interface="com.dzmsoft.ucs.api.service.UserService"
		ref="userServiceImpl" validation="${dubbo.service.validation}"
		version="${dubbo.service.version}" timeout="${dubbo.service.timeout}"
		retries="${dubbo.service.retries}" loadbalance="${dubbo.service.loadbalance}"
		actives="${dubbo.service.actives}" />
</beans>
 类似资料: