MongoDB persistence adapter with Test Containers
Sven's practical approach to explaining hexagonal architecture is fantastic. Adding a persistence adapter that uses a non-relational technology is relevant, demonstrating even more explicitly that the rich domain can be fully reused.
MongoDB is a successful non-relational database system in the industry and integrates well into the Spring ecosystem. That is why it has been selected as an additional adapter in this excellent hexagonal architecture example. All tests, both unit tests and end-to-end tests, passed successfully.
The Singleton pattern was implemented to use the same MongoDB Docker container in both tests. I would be happy to receive feedback on how to improve this implementation: See: https://java.testcontainers.org/test_framework_integration/manual_lifecycle_control/#singleton-containers
Of course, I am also happy to provide top-quality documentation on par with Sven's original documentation.
Co-authored-by: Francisco José Nebrera [email protected]