From ac2ee0a1e9144b9c756354712628d545e23c37d8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 12 Apr 2020 19:54:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=20user=20=E6=A8=A1=E5=9D=97=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=20SCA=20Dubbo=20=E5=92=8C=20Nacos=20Discovery=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user/pom.xml | 12 +++++++++++ user/user-service-impl/pom.xml | 16 ++++----------- .../resources/config/application-test.yaml | 7 ------- .../main/resources/config/application.yaml | 20 ++++++++++++++++--- 4 files changed, 33 insertions(+), 22 deletions(-) delete mode 100644 user/user-service-impl/src/main/resources/config/application-test.yaml diff --git a/user/pom.xml b/user/pom.xml index 4be0b008..cb5bb156 100644 --- a/user/pom.xml +++ b/user/pom.xml @@ -18,4 +18,16 @@ user-service-impl + + + + cn.iocoder.mall + common-dependencies + 1.0-SNAPSHOT + pom + import + + + + diff --git a/user/user-service-impl/pom.xml b/user/user-service-impl/pom.xml index c3c92503..b2845230 100644 --- a/user/user-service-impl/pom.xml +++ b/user/user-service-impl/pom.xml @@ -55,22 +55,14 @@ - org.apache.dubbo - dubbo - - - org.apache.dubbo - dubbo-spring-boot-starter + com.alibaba.cloud + spring-cloud-starter-dubbo - org.apache.curator - curator-recipes - - - org.apache.curator - curator-framework + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery diff --git a/user/user-service-impl/src/main/resources/config/application-test.yaml b/user/user-service-impl/src/main/resources/config/application-test.yaml deleted file mode 100644 index f96dc722..00000000 --- a/user/user-service-impl/src/main/resources/config/application-test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -spring: - # datasource - datasource: - url: jdbc:mysql://192.168.88.14:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8 - driver-class-name: com.mysql.jdbc.Driver - username: root - password: ${MALL_MYSQL_PASSWORD} diff --git a/user/user-service-impl/src/main/resources/config/application.yaml b/user/user-service-impl/src/main/resources/config/application.yaml index 3131ab50..92da8d6c 100644 --- a/user/user-service-impl/src/main/resources/config/application.yaml +++ b/user/user-service-impl/src/main/resources/config/application.yaml @@ -6,6 +6,13 @@ spring: username: root password: ${MALL_MYSQL_PASSWORD} + # Spring Cloud 配置项 + cloud: + nacos: + # Spring Cloud Nacos Discovery 配置项 + discovery: + server-addr: 127.0.0.1:8848 # Nacos 服务器地址 + # mybatis-plus mybatis-plus: configuration: @@ -18,15 +25,22 @@ mybatis-plus: mapperLocations: classpath*:mapper/*.xml typeAliasesPackage: cn.iocoder.mall.user.biz.dataobject -# dubbo +# Dubbo 配置项 dubbo: + # 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, product-application # 设置订阅的应用列表,默认为 * 订阅所有应用 + # Dubbo 提供者的协议 protocol: - port: -1 name: dubbo + port: -1 + # Dubbo 提供服务的扫描基础包 scan: base-packages: cn.iocoder.mall.user.biz.service + # Dubbo 服务提供者的配置 provider: filter: -exception MobileCodeService: