Rationale behind Dependency Injection Container libraries

Yeah you do make a point, if a domain model has like 5+ dependencies on other different domain models, I will need to supply its repository’s constructor with 5+ other repositories. This can soon go out of control, and configuration scattered across multiple files sure is another problem.

But your proposed alternative has an issue as well. Since this array for mapping information is shared across all repositories, I feel that it has become some kind of service locator for the persistence layer. I’d suppose this array is created somewhere and passed as constructor parameter to all repositories. A non-static service locator does the same thing if you inject it to a class’ constructor, just the syntax is different. Maybe I am confused and missing something here?