Linked to #570 (Phase 1 PR)
Motivation
The current backend architecture relies heavily on the service layer to interact with the internals of the entities saved in the repositories. Much of the operations could be done more efficiently at the backend level, profiting from performance enhancements and modularity.
Other than that, concurrency and scalability could be easier achieved with comparably less impact on performance.
Roadmap
The scope of the changes is large. Therefore, the changes will be implemented in several phases:
Phase 1: Structural changes ✅
- Refactor
Crud*Repository (service layer) to receive the *Backend as a Spring component
- Replace InMemory implementation with a spring-data provided (JPA + H2 e.g.)
- Replace the
*Service dependency in the Service Level with the *Backend using repository fragments (*ServiceBackend) [1, 2]
- Implement the
*ServiceBackend for InMemory and MongoDB [2]
Tests must be adapted according to the changes.
Phase 2: Filtering
Supersedes #516
- Add QueryDslExecutor [3] to
*Backend
- Implement
getAll* using the QueryDsl
Phase 3: Pagination
Look at [4] for example using PagingAndSortingRepository
Jannis Norte:
Found implementation for MongoDB; see [5]
References
[1] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.custom-implementations
[2] https://github.com/spring-projects/spring-data-examples/tree/main/mongodb/aggregation/src/main/java/example/springdata/mongodb/aggregation
[3] https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/querydsl/QuerydslPredicateExecutor.html
[4] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.definition
[5] https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.html
Linked to #570 (Phase 1 PR)
Motivation
The current backend architecture relies heavily on the service layer to interact with the internals of the entities saved in the repositories. Much of the operations could be done more efficiently at the backend level, profiting from performance enhancements and modularity.
Other than that, concurrency and scalability could be easier achieved with comparably less impact on performance.
Roadmap
The scope of the changes is large. Therefore, the changes will be implemented in several phases:
Phase 1: Structural changes ✅
Crud*Repository(service layer) to receive the*Backendas a Spring component*Servicedependency in the Service Level with the*Backendusing repository fragments (*ServiceBackend) [1, 2]*ServiceBackendfor InMemory and MongoDB [2]Tests must be adapted according to the changes.
Phase 2: Filtering
Supersedes #516
*BackendgetAll*using the QueryDslPhase 3: Pagination
Look at [4] for example using
PagingAndSortingRepositoryReferences
[1] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.custom-implementations
[2] https://github.com/spring-projects/spring-data-examples/tree/main/mongodb/aggregation/src/main/java/example/springdata/mongodb/aggregation
[3] https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/querydsl/QuerydslPredicateExecutor.html
[4] https://docs.spring.io/spring-data/mongodb/docs/3.3.5/reference/html/#repositories.definition
[5] https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/repository/support/SimpleMongoRepository.html