From 3b49aff5a4fe4165ca2f2df792c391f899d5b00e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 12 Apr 2020 20:36:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=20search=20=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=8E=A5=E5=85=A5=20SCA=20Dubbo=20=E5=92=8C=20Nacos=20Discover?= =?UTF-8?q?y=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search/pom.xml | 13 +++++++++++ search/search-service-impl/pom.xml | 20 ++++------------- .../main/resources/config/application.yaml | 22 ++++++++++++++----- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/search/pom.xml b/search/pom.xml index 31c62ad3..250fc31c 100644 --- a/search/pom.xml +++ b/search/pom.xml @@ -16,4 +16,17 @@ search-service-api search-service-impl + + + + + cn.iocoder.mall + common-dependencies + 1.0-SNAPSHOT + pom + import + + + + diff --git a/search/search-service-impl/pom.xml b/search/search-service-impl/pom.xml index c428d048..a5ef51c2 100644 --- a/search/search-service-impl/pom.xml +++ b/search/search-service-impl/pom.xml @@ -42,22 +42,14 @@ - org.apache.dubbo - dubbo - - - org.apache.dubbo - dubbo-spring-boot-starter + com.alibaba.cloud + spring-cloud-starter-dubbo - org.apache.curator - curator-framework - - - org.apache.curator - curator-recipes + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery @@ -78,10 +70,6 @@ spring-boot-starter-test test - - org.apache.curator - curator-framework - org.springframework.boot spring-boot-starter-web diff --git a/search/search-service-impl/src/main/resources/config/application.yaml b/search/search-service-impl/src/main/resources/config/application.yaml index e58d6f5f..c00f9525 100644 --- a/search/search-service-impl/src/main/resources/config/application.yaml +++ b/search/search-service-impl/src/main/resources/config/application.yaml @@ -7,17 +7,29 @@ spring: repositories: enable: true -# dubbo + # Spring Cloud 配置项 + cloud: + nacos: + # Spring Cloud Nacos Discovery 配置项 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 + +# Dubbo 配置项 dubbo: - application: - name: search-service + # Dubbo 注册中心 registry: - address: zookeeper://127.0.0.1:2181 + address: spring-cloud://127.0.0.1:8848 # 指定 Dubbo 服务注册中心的地址 + # Spring Cloud Alibaba Dubbo 专属配置 + cloud: + subscribed-services: admin-application, order-application, product-application # 设置订阅的应用列表,默认为 * 订阅所有应用 + # Dubbo 提供者的协议 protocol: - port: -1 name: dubbo + port: -1 + # Dubbo 提供服务的扫描基础包 scan: base-packages: cn.iocoder.mall.search.biz.service + # Dubbo 服务提供者的配置 provider: filter: -exception ProductSearchService: