DDD和应用层

发布于 2025-01-06 16:35:09 字数 435 浏览 1 评论 0原文

我在DDD中添加@Stateful、@Stateless、@WebService等是应用层(应用服务)吗?从下面的链接来看,这似乎是正确的。

第二个问题:我创建了一个存储库类,是否所有涉及存储库的方法调用都应该包装在应用程序服务中?或者我可以直接在 JSF 中的支持 bean 中使用存储库类吗?何时、什么内容放入应用层。我不明白 EJB 在这个 artitechture 中属于什么位置。

应用程序层:该层协调应用程序活动。它不包含任何业务逻辑。它不保存业务对象的状态,但可以保存应用程序任务进度的状态。

http://www.infoq.com/articles/ddd-in-practice

Is the application layer (application services) where I add @Stateful, @Stateless, @WebService etc. in DDD? From the link below this seems to be right.

Second question: I have made a repository class, should all method calls involving repository be wrappen in an application service? Or can I use repository classes directly in let say backing beans in JSF? When and what do I put in the application layer. I don't understand where the EJBs belong in this artitechture.

Application Layer: This layer coordinates the application activity. It doesn't contain any business logic. It does not hold the state of business objects, but it can hold the state of an application task's progress.

http://www.infoq.com/articles/ddd-in-practice

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橙味迷妹 2025-01-13 16:35:09

Java EE提倡贫血模型,与DDD相反。如果你想要DDD,你的实体也必须执行业务逻辑,这与服务层和实体的分离是相反的。

Java EE advocates anemic model, which is the opposite of DDD. If you want DDD, your entities must also perform the business logic, which is contrary to the separation of service layer and entities.

红焚 2025-01-13 16:35:09

假设在 DDD 架构中应用层和所有其他层仅与系统的较低层通信。因此,应用程序服务包装存储库,但如果您使用依赖项注入,则可以沿应用程序服务层重用所有存储库

。AppService 的真正工作是协调其他服务或存储库或包容性域服务之间的操作。

在您的实体中,业务逻辑必须仅与您自己的实体有关。始终尊重单一责任原则 (http://www. developerfusion.com/article/137636/take-the-single-responsibility-principle-seriously/)。

我希望有帮助

It's supposed that in DDD architecture the Application Layer and all the other layer communicate only with lower layer of the system. For this reason the application service wrapp repositories, but if you are using dependency inyection you can reuse all your repositories along the application service layer

The real work of AppService is to coordinate operations beetwen other service or repositories or inclusive domain services.

In your entities must to be bussiness logic only about your own entities. Always respecting Single Responsibility Principle (http://www.developerfusion.com/article/137636/taking-the-single-responsibility-principle-seriously/).

I hope be helpful

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文