- 后端:Order 模块,引用 Dubbo 服务的版本
This commit is contained in:
parent
de9f191c30
commit
861dcc14e5
@ -29,11 +29,11 @@ import static cn.iocoder.common.framework.vo.CommonResult.success;
|
|||||||
@RequestMapping("users/cart")
|
@RequestMapping("users/cart")
|
||||||
public class UsersCartController {
|
public class UsersCartController {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.provider.CartService.version}")
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true")
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
@PostMapping("add")
|
@PostMapping("add")
|
||||||
|
@ -32,14 +32,14 @@ import java.util.stream.Collectors;
|
|||||||
* 购物车服务 Service 实现类
|
* 购物车服务 Service 实现类
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@org.apache.dubbo.config.annotation.Service(validation = "true")
|
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.CartService.version}")
|
||||||
public class CartServiceImpl implements CartService {
|
public class CartServiceImpl implements CartService {
|
||||||
|
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
|
||||||
private ProductSpuService productSpuService;
|
private ProductSpuService productSpuService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.PromotionActivityService.version}")
|
||||||
private PromotionActivityService promotionActivityService;
|
private PromotionActivityService promotionActivityService;
|
||||||
@Reference(validation = "true")
|
@Reference(validation = "true", version = "${dubbo.consumer.CouponService.version}")
|
||||||
private CouponService couponService;
|
private CouponService couponService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -23,6 +23,16 @@ dubbo:
|
|||||||
name: dubbo
|
name: dubbo
|
||||||
scan:
|
scan:
|
||||||
base-packages: cn.iocoder.mall.order.biz.service
|
base-packages: cn.iocoder.mall.order.biz.service
|
||||||
|
provider:
|
||||||
|
CartService:
|
||||||
|
version: 1.0.0
|
||||||
|
consumer:
|
||||||
|
ProductSpuService:
|
||||||
|
version: 1.0.0
|
||||||
|
PromotionActivityService:
|
||||||
|
version: 1.0.0
|
||||||
|
CouponService:
|
||||||
|
version: 1.0.0
|
||||||
|
|
||||||
# logging
|
# logging
|
||||||
logging:
|
logging:
|
||||||
|
@ -58,6 +58,7 @@ public class DubboReferencePool {
|
|||||||
reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
|
reference.setInterface(notifyUrlParts[0]); // 弱类型接口名
|
||||||
reference.setGeneric(true); // 声明为泛化接口
|
reference.setGeneric(true); // 声明为泛化接口
|
||||||
reference.setApplication(application);
|
reference.setApplication(application);
|
||||||
|
reference.setVersion("1.0.0"); // TODO 芋艿,后面要优化下。
|
||||||
// 获得 GenericService 对象
|
// 获得 GenericService 对象
|
||||||
GenericService genericService = reference.get();
|
GenericService genericService = reference.get();
|
||||||
// 构建最终的 ReferenceMeta 对象
|
// 构建最终的 ReferenceMeta 对象
|
||||||
|
Loading…
Reference in New Issue
Block a user