【发布时间】:2021-06-02 01:27:06
【问题描述】:
领域层和应用层可以感知应用状态吗?应用程序状态是指单个应用程序实例的状态。
例如,如果我正在送餐,并且用户登录到他的帐户并下订单。现在我需要在这个当前登录的用户下添加这个订单。
我感到困惑的部分是,如果应用程序层服务具有将已订购商品添加到此用户订购商品列表的功能,是否可以知道当前登录的是哪个用户,这将是一个单独的应用实例。
class MakeOrderService {
void makeOrder() {
// Here order is being made assuming this function can get the
// id of the currently logged in user without it being passed
// in as a parameter from the controller where its being called.
}
}
谢谢。
【问题讨论】:
标签: java architecture domain-driven-design subdomain applicationservice