DDD和应用层
我在DDD中添加@Stateful、@Stateless、@WebService等是应用层(应用服务)吗?从下面的链接来看,这似乎是正确的。
第二个问题:我创建了一个存储库类,是否所有涉及存储库的方法调用都应该包装在应用程序服务中?或者我可以直接在 JSF 中的支持 bean 中使用存储库类吗?何时、什么内容放入应用层。我不明白 EJB 在这个 artitechture 中属于什么位置。
应用程序层:该层协调应用程序活动。它不包含任何业务逻辑。它不保存业务对象的状态,但可以保存应用程序任务进度的状态。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.
假设在 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