Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop Singleton pattern and implement Dependency Injection
Instead of using a Singleton pattern, ensure data consistency and prevent duplication of `allAnimals` by passing the same `AnimalService` instance between controllers. Additionally, ensure data is not loaded twice by setting a flag that must be checked before calling `loadFromDb()`. This maintains the benefits previously established by the Singleton while reducing complexity and improving testability.
- Loading branch information