当前位置: 首页 > news >正文

spring-dubbo

<dubbo:reference> 没定义 id,默认不会暴露这个 Bean 给 Spring 注入;故在spring中集成dubbo,在消费端一定要定义这个id;

然后集成的主要步骤:

第一点:

<!-- Apache Dubbo 核心 -->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>2.7.13</version>
</dependency>
<!-- Dubbo与zookeeper的整合配置自动引入相关依赖包-->
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<version>2.7.13</version>
<type>pom</type>
</dependency>

第二点:

@ImportResource(locations = {"classpath:dubbo/spring-dubbo.xml"})

也可以借助@Profile指定不同环境的

@Configuration
@ImportResource(locations = {"classpath:dubbo/spring-dubbo-dev.xml"})
@Profile("dev")
public class DubboDevConfiguration {
}

第三点:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
default-autowire="byName"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd
">

<dubbo:application name="manage-${spring.profiles.active}"/>

<dubbo:registry protocol="zookeeper" address="xx.xx.cc:110,xx.xxx.cc:110,xxx.xx.cc:30002" />

<dubbo:reference id="dealerScService" check="false" lazy="true" interface="com.xx.xx.oms.api.DealerScService" version="1.0.0"  group="dev" />


</beans>

http://www.dtcms.com/a/318272.html

相关文章:

  • Post-train 入门(1):SFT / DPO / Online RL 概念理解和分类
  • C++与C语言实现Stack的对比分析
  • sqli-labs通关笔记-第34关POST宽字符注入(单引号闭合 手工注入+脚本注入两种方法)
  • Verilog 仿真问题:打拍失败
  • FPGA学习笔记——VGA简介
  • Excel单元格设置下拉框、选项背景
  • 20250806给PRO-RK3566开发板在Buildroot系统下扩大rootfs分区2GB
  • 实习文档背诵
  • 解决Cloudflare人机验证加载异常:从常规排查到hosts配置优化
  • 【软件介绍】RVC本地部署使用方法
  • Linux基础命令详解手册
  • css怪异模式(Quirks Mode)和标准模式(Standards Mode)最明显的区别
  • 【CVPR2025】Mr.DETR: 通过多路线训练机制改进DETR,并进行“one to one”和“one to many”的预测
  • pytorch安装
  • ​​MCU程序的存储方式与存储区域大小要求​
  • c++ template in .h and .cpp
  • RocketMQ和Kafka一样有重平衡的问题吗?
  • 机器学习——朴素贝叶斯
  • Java面试题和答案大全
  • Web 端 AI 图像生成技术的应用与创新:虚拟背景与创意图像合成
  • Session 和 JWT(JSON Web Token)
  • [AI]从零开始的SDXL LORA训练教程
  • 机器视觉的智能手表贴合应用
  • Android 之 ViewBinding 实现更安全、高效的视图绑定
  • envFrom 是一个 列表类型字段bug
  • W3D引擎游戏开发----从入门到精通【22】
  • 《聚氨酯垫性能优化在超薄晶圆研磨中对 TTV 的保障技术》
  • 小实验--震动点灯
  • 昇思+昇腾开发板+DeepSeek模型推理和性能优化
  • Python实现信号小波分解与重构