christophknabe / spring-ddd-bank

A sample project following Domain Driven Design with Spring Data JPA
GNU Lesser General Public License v2.1
512 stars 125 forks source link

is there lack application layer? #13

Closed damozhiying closed 6 years ago

damozhiying commented 6 years ago

in ddd,there is a layer application, i think domain layer shouldn't have repository resources, in application layer or domain service can have repository resources,

christophknabe commented 6 years ago

Thanks for your feedback.

  1. In Other Characteristics I wrote "As simplification an application layer is not implemented, but the interface layer is made transactional.". Up to now this is sufficient for me, as the only feature I would need from an application layer would be to call the domain methods in a transaction. This is performed by annotating the rest_interface.ApplicationController as @Transactional.
  2. "domain layer shouldn't have repository resources": I agree that there is one school, where only services may have access to repositories. But this results in an AnemicDomainModel (entity classes have only setters and getters, but no business relevant methods). I prefer to follow the other school of Rich Domain Models. As I understand it, there entity classes may have access to repositories, too.