- 后端:解决 Order 和 Search 的 Dubbo 服务引用问题。

This commit is contained in:
YunaiV 2019-05-09 01:16:12 +08:00
parent 3c2fbc1594
commit c550340c7c
9 changed files with 30 additions and 19 deletions

View File

@ -42,9 +42,9 @@ public class OrderController {
@Reference(validation = "true")
private OrderService orderService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
private CartService cartService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
@GetMapping("order_page")

View File

@ -37,7 +37,7 @@ public class OrderLogisticsController {
@Reference(validation = "true")
private OrderLogisticsService orderLogisticsService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
@GetMapping("info")

View File

@ -27,7 +27,7 @@ public class OrderReturnController {
@Reference(validation = "true")
private OrderReturnService orderReturnService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.DataDictService.version}")
private DataDictService dataDictService;
@GetMapping("reason")

View File

@ -53,7 +53,7 @@ public class OrderReturnServiceImpl implements OrderReturnService {
@Reference(validation = "true")
private OrderLogisticsService orderLogisticsService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.PayRefundService.version}")
private PayRefundService payRefundService;
@Override

View File

@ -65,13 +65,13 @@ public class OrderServiceImpl implements OrderService {
@Autowired
private CartServiceImpl cartService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
private ProductSpuService productSpuService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.UserAddressService.version}")
private UserAddressService userAddressService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.PayTransactionService.version}")
private PayTransactionService payTransactionService;
@Reference(validation = "true")
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
private CouponService couponService;
@Override

View File

@ -33,6 +33,14 @@ dubbo:
version: 1.0.0
CouponService:
version: 1.0.0
PayRefundService:
version: 1.0.0
UserAddressService:
version: 1.0.0
PayTransactionService:
version: 1.0.0
DataDictService:
version: 1.0.0
# logging
logging:

View File

@ -58,7 +58,7 @@ public class DubboReferencePool {
reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
reference.setGeneric(true); // 声明为泛化接口
reference.setApplication(application);
reference.setVersion("1.0.0"); // TODO 芋艿后面要优化下
// reference.setVersion("*"); // TODO 芋艿后面要优化下
// 获得 GenericService 对象
GenericService genericService = reference.get();
// 构建最终的 ReferenceMeta 对象

View File

@ -38,15 +38,6 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>com.alibaba.boot</groupId>-->
<!--<artifactId>dubbo-spring-boot-starter</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>

View File

@ -32,6 +32,18 @@
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>