From c50f99e7b3a36383dc9d805e61f2c8870183bd3e Mon Sep 17 00:00:00 2001 From: zhuyang <1qazxsw2> Date: Wed, 6 Oct 2021 22:50:17 +0800 Subject: [PATCH] =?UTF-8?q?SPU.get=E6=8E=A5=E5=8F=A3=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/setup/quick-start.md | 2 +- management-web-app/pom.xml | 5 +++ .../ManagementWebApplication.java | 4 +++ .../product/ProductSpuController.http | 8 +++++ .../managementweb/feign/ProductSpuFeign.java | 20 ++++++++++++ .../manager/product/ProductSpuManager.java | 7 ++++- .../src/main/resources/application-dev.yml | 6 ++-- .../src/main/resources/application-local.yml | 6 ++-- .../main/resources/config/application.yaml | 2 +- .../main/resources/config/application.yaml | 2 +- .../src/main/resources/application-dev.yaml | 10 +++--- .../src/main/resources/application-local.yaml | 12 +++---- .../src/main/resources/application.yaml | 2 +- .../common/dubbo/DubboGenericInvokerTest.java | 2 +- .../product-service-api/pom.xml | 5 +++ .../product-service-app/pom.xml | 4 +++ .../ProductServiceApplication.java | 4 +++ .../controller/ProductSpuController.http | 4 +++ .../controller/SpuController.java | 31 +++++++++++++++++++ .../src/main/resources/application-dev.yaml | 10 +++--- .../src/main/resources/application-local.yaml | 10 +++--- .../src/main/resources/application.yaml | 2 +- .../src/main/resources/application-dev.yaml | 10 +++--- .../src/main/resources/application-local.yaml | 10 +++--- .../src/main/resources/application.yaml | 2 +- .../src/main/resources/application-dev.yaml | 6 ++-- .../src/main/resources/application-local.yaml | 6 ++-- .../src/main/resources/application.yaml | 6 ++-- .../src/main/resources/application-dev.yml | 6 ++-- .../src/main/resources/application-local.yml | 6 ++-- .../src/main/resources/application-dev.yaml | 12 +++---- .../src/main/resources/application-local.yaml | 12 +++---- .../src/main/resources/application-dev.yaml | 10 +++--- .../src/main/resources/application-local.yaml | 10 +++--- .../src/main/resources/application.yaml | 2 +- .../src/main/resources/application-dev.yaml | 10 +++--- .../src/main/resources/application-local.yaml | 10 +++--- 37 files changed, 183 insertions(+), 93 deletions(-) create mode 100644 management-web-app/src/main/java/cn/iocoder/mall/managementweb/feign/ProductSpuFeign.java create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductSpuController.http create mode 100644 product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/SpuController.java diff --git a/docs/setup/quick-start.md b/docs/setup/quick-start.md index c92cd8f6..f7657464 100644 --- a/docs/setup/quick-start.md +++ b/docs/setup/quick-start.md @@ -44,7 +44,7 @@ spring: url: jdbc:mysql://s1.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 # 请修改成你本地的 MySQL url driver-class-name: com.mysql.jdbc.Driver username: root # 请修改成你本地的 MySQL username - password: 3WLiVUBEwTbvAfsh # 请修改成你本地的 MySQL password + password: zhuyang # 请修改成你本地的 MySQL password ``` # 4. Zookeeper diff --git a/management-web-app/pom.xml b/management-web-app/pom.xml index 06b23a98..bed43c5d 100644 --- a/management-web-app/pom.xml +++ b/management-web-app/pom.xml @@ -106,6 +106,11 @@ mapstruct-jdk8 + + + org.springframework.cloud + spring-cloud-starter-openfeign + diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java index 12197953..6812bb72 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/ManagementWebApplication.java @@ -2,8 +2,12 @@ package cn.iocoder.mall.managementweb; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients public class ManagementWebApplication { public static void main(String[] args) { diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http index 00d3c8f3..6ffb59c6 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http @@ -49,3 +49,11 @@ id=59&name=测试商品标题&description=测试商品描述&cid=637&sellPoint= &skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4 ### + +### /product-spu/get +GET http://127.0.0.1:18083/management-api/product-spu/get?productSpuId=32 +Content-Type: application/x-www-form-urlencoded +Authorization:Bearer yudaoyuanma + +### + diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/feign/ProductSpuFeign.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/feign/ProductSpuFeign.java new file mode 100644 index 00000000..2597badf --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/feign/ProductSpuFeign.java @@ -0,0 +1,20 @@ +package cn.iocoder.mall.managementweb.feign; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +@FeignClient(value = "product-service") +public interface ProductSpuFeign { + /** + * 获得商品 SPU + * + * @param productSpuId 商品 SPU 编号 + * @return 商品 SPU + */ + @GetMapping(value = "/product/spu/get") + CommonResult getProductSpu(@RequestParam("productSpuId") Integer productSpuId); + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java index 8655f307..ef2c4d73 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java @@ -7,9 +7,11 @@ import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReq import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; import cn.iocoder.mall.managementweb.convert.product.ProductSpuConvert; +import cn.iocoder.mall.managementweb.feign.ProductSpuFeign; import cn.iocoder.mall.productservice.rpc.spu.ProductSpuRpc; import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -23,6 +25,9 @@ public class ProductSpuManager { @DubboReference(version = "${dubbo.consumer.ProductSpuRpc.version}") private ProductSpuRpc productSpuRpc; + @Autowired + private ProductSpuFeign productSpuFeign; + /** * 创建商品 SPU * @@ -52,7 +57,7 @@ public class ProductSpuManager { * @return 商品 SPU */ public ProductSpuRespVO getProductSpu(Integer productSpuId) { - CommonResult getProductSpuResult = productSpuRpc.getProductSpu(productSpuId); + CommonResult getProductSpuResult = productSpuFeign.getProductSpu(productSpuId); getProductSpuResult.checkError(); return ProductSpuConvert.INSTANCE.convert(getProductSpuResult.getData()); } diff --git a/management-web-app/src/main/resources/application-dev.yml b/management-web-app/src/main/resources/application-dev.yml index 31a3a702..9e9f28fb 100644 --- a/management-web-app/src/main/resources/application-dev.yml +++ b/management-web-app/src/main/resources/application-dev.yml @@ -4,15 +4,15 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Mall 认证安全配置 mall.security.admin.demo: true # 是否开启演示模式 diff --git a/management-web-app/src/main/resources/application-local.yml b/management-web-app/src/main/resources/application-local.yml index 2e26cd38..fede4927 100644 --- a/management-web-app/src/main/resources/application-local.yml +++ b/management-web-app/src/main/resources/application-local.yml @@ -4,12 +4,12 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/moved/product/product-service-impl/src/main/resources/config/application.yaml b/moved/product/product-service-impl/src/main/resources/config/application.yaml index 66af9a89..10a3e942 100644 --- a/moved/product/product-service-impl/src/main/resources/config/application.yaml +++ b/moved/product/product-service-impl/src/main/resources/config/application.yaml @@ -4,7 +4,7 @@ spring: url: jdbc:mysql://s1.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: diff --git a/moved/system/system-service-impl/src/main/resources/config/application.yaml b/moved/system/system-service-impl/src/main/resources/config/application.yaml index a44537f1..bef7c0a0 100644 --- a/moved/system/system-service-impl/src/main/resources/config/application.yaml +++ b/moved/system/system-service-impl/src/main/resources/config/application.yaml @@ -4,7 +4,7 @@ spring: url: jdbc:mysql://s1.iocoder.cn:3306/mall_admin?useSSL=false&useUnicode=true&characterEncoding=UTF-8 driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: diff --git a/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml b/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml index c7b4acbb..faab4b01 100644 --- a/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml +++ b/pay-service-project/pay-service-app/src/main/resources/application-dev.yaml @@ -1,24 +1,24 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # XXL-Job 配置项 xxl: diff --git a/pay-service-project/pay-service-app/src/main/resources/application-local.yaml b/pay-service-project/pay-service-app/src/main/resources/application-local.yaml index b57d1302..ffc81eb4 100644 --- a/pay-service-project/pay-service-app/src/main/resources/application-local.yaml +++ b/pay-service-project/pay-service-app/src/main/resources/application-local.yaml @@ -1,24 +1,24 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_pay?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 @@ -28,7 +28,7 @@ xxl: job: enabled: false # 本地开发时,关闭 XXL-Job admin: - addresses: http://400-infra.server.iocoder.cn:9099 + addresses: http://localhost:9099 executor: appname: ${spring.application.name} accessToken: diff --git a/pay-service-project/pay-service-app/src/main/resources/application.yaml b/pay-service-project/pay-service-app/src/main/resources/application.yaml index 57ba7cf4..e35632dd 100644 --- a/pay-service-project/pay-service-app/src/main/resources/application.yaml +++ b/pay-service-project/pay-service-app/src/main/resources/application.yaml @@ -46,7 +46,7 @@ dubbo: # RocketMQ 配置项 rocketmq: - name-server: 400-infra.server.iocoder.cn:9876 + name-server: localhost:9876 producer: group: ${spring.application.name}-producer-group diff --git a/pay-service-project/pay-service-integration-test/src/test/java/cn/iocoder/mall/payservice/common/dubbo/DubboGenericInvokerTest.java b/pay-service-project/pay-service-integration-test/src/test/java/cn/iocoder/mall/payservice/common/dubbo/DubboGenericInvokerTest.java index 878c7295..603267cd 100644 --- a/pay-service-project/pay-service-integration-test/src/test/java/cn/iocoder/mall/payservice/common/dubbo/DubboGenericInvokerTest.java +++ b/pay-service-project/pay-service-integration-test/src/test/java/cn/iocoder/mall/payservice/common/dubbo/DubboGenericInvokerTest.java @@ -15,7 +15,7 @@ public class DubboGenericInvokerTest { application.setName("api-generic-consumer"); RegistryConfig registry = new RegistryConfig(); - registry.setAddress("nacos://400-infra.server.iocoder.cn:8848?namespace=dev"); + registry.setAddress("nacos://localhost:8848?namespace=dev"); application.setRegistry(registry); diff --git a/product-service-project/product-service-api/pom.xml b/product-service-project/product-service-api/pom.xml index e267473c..1cbc81a0 100644 --- a/product-service-project/product-service-api/pom.xml +++ b/product-service-project/product-service-api/pom.xml @@ -26,6 +26,11 @@ org.projectlombok lombok + + org.springframework.cloud + spring-cloud-openfeign-core + RELEASE + diff --git a/product-service-project/product-service-app/pom.xml b/product-service-project/product-service-app/pom.xml index cafab548..4c886ba4 100644 --- a/product-service-project/product-service-app/pom.xml +++ b/product-service-project/product-service-app/pom.xml @@ -102,6 +102,10 @@ aspectjweaver 1.9.6 + + io.swagger + swagger-annotations + diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java index ac41a7aa..5c5c30ed 100644 --- a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java @@ -2,8 +2,12 @@ package cn.iocoder.mall.productservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.openfeign.EnableFeignClients; @SpringBootApplication +@EnableDiscoveryClient +@EnableFeignClients public class ProductServiceApplication { public static void main(String[] args) { diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductSpuController.http b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductSpuController.http new file mode 100644 index 00000000..48ef87dd --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductSpuController.http @@ -0,0 +1,4 @@ +### /product/spu/get 获得商品 SPU +GET http://localhost:38082/product/spu/get?productSpuId=32 +### + diff --git a/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/SpuController.java b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/SpuController.java new file mode 100644 index 00000000..6f7fd790 --- /dev/null +++ b/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/SpuController.java @@ -0,0 +1,31 @@ +package cn.iocoder.mall.productservice.controller; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.mall.productservice.manager.spu.ProductSpuManager; +import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import static cn.iocoder.common.framework.vo.CommonResult.success; + +@RestController +@RequestMapping("/product/spu") +@Api("商品spu") +public class SpuController { + @Autowired + private ProductSpuManager productSpuManager; + + @GetMapping("/get") + @ApiOperation("获得商品 SPU") + @ApiImplicitParam(name = "productSpuId", value = "商品 SPU 编号", required = true) + public CommonResult getProductSpu(@RequestParam(value="productSpuId") Integer productSpuId) { + return success(productSpuManager.getProductSpu(productSpuId)); + } + +} diff --git a/product-service-project/product-service-app/src/main/resources/application-dev.yaml b/product-service-project/product-service-app/src/main/resources/application-dev.yaml index 8d210f36..7256a5bb 100644 --- a/product-service-project/product-service-app/src/main/resources/application-dev.yaml +++ b/product-service-project/product-service-app/src/main/resources/application-dev.yaml @@ -1,21 +1,21 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/product-service-project/product-service-app/src/main/resources/application-local.yaml b/product-service-project/product-service-app/src/main/resources/application-local.yaml index 099913a1..8c275253 100644 --- a/product-service-project/product-service-app/src/main/resources/application-local.yaml +++ b/product-service-project/product-service-app/src/main/resources/application-local.yaml @@ -1,24 +1,24 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/product-service-project/product-service-app/src/main/resources/application.yaml b/product-service-project/product-service-app/src/main/resources/application.yaml index e169a0bf..296e61a8 100644 --- a/product-service-project/product-service-app/src/main/resources/application.yaml +++ b/product-service-project/product-service-app/src/main/resources/application.yaml @@ -42,7 +42,7 @@ dubbo: # RocketMQ 配置项 rocketmq: - name-server: 400-infra.server.iocoder.cn:9876 + name-server: localhost:9876 producer: group: ${spring.application.name}-producer-group diff --git a/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml b/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml index 99a349fa..946ea52b 100644 --- a/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml +++ b/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml @@ -1,21 +1,21 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml b/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml index 19e0f347..43bff167 100644 --- a/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml +++ b/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml @@ -1,24 +1,24 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/promotion-service-project/promotion-service-app/src/main/resources/application.yaml b/promotion-service-project/promotion-service-app/src/main/resources/application.yaml index 542011fa..10d90e89 100644 --- a/promotion-service-project/promotion-service-app/src/main/resources/application.yaml +++ b/promotion-service-project/promotion-service-app/src/main/resources/application.yaml @@ -46,7 +46,7 @@ dubbo: # RocketMQ 配置项 rocketmq: - name-server: 400-infra.server.iocoder.cn:9876 + name-server: localhost:9876 producer: group: ${spring.application.name}-producer-group diff --git a/search-service-project/search-service-app/src/main/resources/application-dev.yaml b/search-service-project/search-service-app/src/main/resources/application-dev.yaml index 2e26cd38..fede4927 100644 --- a/search-service-project/search-service-app/src/main/resources/application-dev.yaml +++ b/search-service-project/search-service-app/src/main/resources/application-dev.yaml @@ -4,12 +4,12 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/search-service-project/search-service-app/src/main/resources/application-local.yaml b/search-service-project/search-service-app/src/main/resources/application-local.yaml index 9c125c50..07ae5f03 100644 --- a/search-service-project/search-service-app/src/main/resources/application-local.yaml +++ b/search-service-project/search-service-app/src/main/resources/application-local.yaml @@ -4,15 +4,15 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/search-service-project/search-service-app/src/main/resources/application.yaml b/search-service-project/search-service-app/src/main/resources/application.yaml index 8b1f9647..71b38c6b 100644 --- a/search-service-project/search-service-app/src/main/resources/application.yaml +++ b/search-service-project/search-service-app/src/main/resources/application.yaml @@ -9,12 +9,12 @@ spring: data: elasticsearch: cluster-name: elasticsearch - cluster-nodes: 400-infra.server.iocoder.cn:9300 + cluster-nodes: localhost:9300 repositories: enable: true elasticsearch: rest: - uris: 400-infra.server.iocoder.cn:9200 + uris: localhost:9200 # Dubbo 配置项 dubbo: @@ -46,7 +46,7 @@ dubbo: # RocketMQ 配置项 rocketmq: - name-server: 400-infra.server.iocoder.cn:9876 + name-server: localhost:9876 # Actuator 监控配置项 management: diff --git a/shop-web-app/src/main/resources/application-dev.yml b/shop-web-app/src/main/resources/application-dev.yml index 2e26cd38..fede4927 100644 --- a/shop-web-app/src/main/resources/application-dev.yml +++ b/shop-web-app/src/main/resources/application-dev.yml @@ -4,12 +4,12 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/shop-web-app/src/main/resources/application-local.yml b/shop-web-app/src/main/resources/application-local.yml index 12e9ed40..d8b2b0c8 100644 --- a/shop-web-app/src/main/resources/application-local.yml +++ b/shop-web-app/src/main/resources/application-local.yml @@ -4,7 +4,7 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Spring 主应用配置 main: @@ -14,5 +14,5 @@ spring: dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/system-service-project/system-service-app/src/main/resources/application-dev.yaml b/system-service-project/system-service-app/src/main/resources/application-dev.yaml index 5f93d363..c6c91d9e 100644 --- a/system-service-project/system-service-app/src/main/resources/application-dev.yaml +++ b/system-service-project/system-service-app/src/main/resources/application-dev.yaml @@ -1,14 +1,14 @@ spring: # MySQL 配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Redis 配置 redis: - host: 400-infra.server.iocoder.cn + host: localhost port: 6379 database: 0 @@ -17,12 +17,12 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/system-service-project/system-service-app/src/main/resources/application-local.yaml b/system-service-project/system-service-app/src/main/resources/application-local.yaml index b59d1922..4a3ed5fd 100644 --- a/system-service-project/system-service-app/src/main/resources/application-local.yaml +++ b/system-service-project/system-service-app/src/main/resources/application-local.yaml @@ -1,14 +1,14 @@ spring: # MySQL 配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_system?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Redis 配置 redis: - host: 400-infra.server.iocoder.cn + host: localhost port: 6379 database: 0 @@ -17,15 +17,15 @@ spring: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml b/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml index 6359e336..a371d4a5 100644 --- a/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml +++ b/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml @@ -1,21 +1,21 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/trade-service-project/trade-service-app/src/main/resources/application-local.yaml b/trade-service-project/trade-service-app/src/main/resources/application-local.yaml index da9304ac..99ebfb16 100644 --- a/trade-service-project/trade-service-app/src/main/resources/application-local.yaml +++ b/trade-service-project/trade-service-app/src/main/resources/application-local.yaml @@ -1,16 +1,16 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # # Spring 主应用配置 # main: @@ -20,8 +20,8 @@ spring: dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/trade-service-project/trade-service-app/src/main/resources/application.yaml b/trade-service-project/trade-service-app/src/main/resources/application.yaml index 41e0ac3c..fe35cf83 100644 --- a/trade-service-project/trade-service-app/src/main/resources/application.yaml +++ b/trade-service-project/trade-service-app/src/main/resources/application.yaml @@ -52,7 +52,7 @@ dubbo: # RocketMQ 配置项 rocketmq: - name-server: 400-infra.server.iocoder.cn:9876 + name-server: localhost:9876 producer: group: ${spring.application.name}-producer-group diff --git a/user-service-project/user-service-app/src/main/resources/application-dev.yaml b/user-service-project/user-service-app/src/main/resources/application-dev.yaml index e0831730..32a4152b 100644 --- a/user-service-project/user-service-app/src/main/resources/application-dev.yaml +++ b/user-service-project/user-service-app/src/main/resources/application-dev.yaml @@ -1,21 +1,21 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: - # address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 + # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/user-service-project/user-service-app/src/main/resources/application-local.yaml b/user-service-project/user-service-app/src/main/resources/application-local.yaml index 6a89f36d..85a68931 100644 --- a/user-service-project/user-service-app/src/main/resources/application-local.yaml +++ b/user-service-project/user-service-app/src/main/resources/application-local.yaml @@ -1,24 +1,24 @@ spring: # 数据源配置项 datasource: - url: jdbc:mysql://400-infra.server.iocoder.cn:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT + url: jdbc:mysql://localhost:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT driver-class-name: com.mysql.jdbc.Driver username: root - password: 3WLiVUBEwTbvAfsh + password: zhuyang # Spring Cloud 配置项 cloud: nacos: # Spring Cloud Nacos Discovery 配置项 discovery: - server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址 + server-addr: localhost:8848 # Nacos 服务器地址 namespace: dev # Nacos 命名空间 # Dubbo 配置项 dubbo: # Dubbo 注册中心 registry: -# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 +# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 + address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 # Dubbo 服务提供者的配置 provider: tag: ${DUBBO_TAG} # Dubbo 路由分组