微服务拆分之后,项目的之间使用通常有两种:
1.提供远程调用的服务自己去管理对外的远程接口,新建一个独立的子模块专门存放对外的远程调用。其他需要调用的客户端引入这个模块即可实现远程调用
2.一个独立的api模块。所有需要远程调用的模块都引入这个模块。
示例
-
hmall - user-service 用户模块 - user-api 用户模块下api模块 - dto api模块下的dto - vo api模块下的vo - client api模块下的远程调用接口 - user-biz 用户模块下的业务功能 - card-service - card-api 购物车模块下api模块 - dto api模块下的dto - vo api模块下的vo - client api模块下的远程调用接口 - card-biz 购物车模块下的业务功能 - item-service - item-api 商品模块下api模块 - dto api模块下的dto - vo api模块下的vo - client api模块下的远程调用接口 - item-biz 商品模块下的业务功能 - gateway 网关 -
hmall - user-service 用户模块 - domain - dto - vo - po - ... - mapper - service - controller - ... - card-service 购物车模块 - item-service 商品模块 - gateway 网关 - openfeign-api 远程服务模块 - dto - vo - client