My understanding has been that dependency injection containers are useful ways to automate dependency injection, but that, essentially, only main should know about the container. This makes a lot of sense--your business logic shouldn't care about how it gets its dependencies.
However, what about factories? Right now, I have an application with a Use Case factory that is a dependency of my Controllers. My use case factory doesn't know about the container--instead, it receives all of the dependencies of the use cases it handles in its constructor, and directly instantiates the use cases, passing the correct dependencies.
This was fine when most of the Use Cases handled by the factory had the same dependencies, but as the application becomes more complex,the number of dependencies increases, and I'm instantiating classes I don't need to construct my Use Case factory. My temptation is to instead pass the dependency injection container into the Use case constructor, so that it can instantiate dependencies on demand via the container.
But that seems like a slippery slope--if I do that, it seems I should just have the container responsible for instantiating the use cases, so that the Factory is essentially a Facade for the container, and if I do THAT, I start wondering why not pass the container directly into my Controllers as a dependency, rather than the factory.
Is there any point along that slope that makes the most sense to stop?