In my DDD-by-book application, I have a repository definition similar to this in my domain:
public interface CustomerRepository {
Customer findById(long id);
...
}
The database integration level contains an implementation of this interface, for example:
public class CustomerDao implements CustomerRepository {
public Customer findById(long id) {
}
}
There is a module for each level, and the database module depends on the domain and all integration libraries (for example, hibernate), and the domain module depends on something. Thus, we have a clean separation of problems and no “technical” domain dependencies, as DDD suggests. As a result, I can switch from the database to read-only memory by creating an appropriate repository implementation. The implementation that is being used is configured in my application level.
, Spring Data around. Spring, .
public interface CustomerRepository implements Repository<Customer, Long> {
....
, , , "" . in-memory spring -data . , .
? ? Spring ?
(BTW: - JPA, javax.persistence. , , javax.persistence . "", "" . , spring -data-annotation .)