Although, I can understand why this makes sense to write this function as static, the answer is simply that DI is not going well with static methods that have an associated state. Injected properties are a state of the object and static methods that have an associated state are considered to be an anti-pattern.
DI sometimes forces you to use pure (not anti) patterns.
If you insist on using static method in your case, I can suggest these to cover your options. All are not perfect.
- Adding the injected objects as parameters to the function.
Document.Read(logger, filePath)
. If you weren't using an IoC framework, the alternative was:new Document(logger).Read(filepath)
which is more or less, the same clumsy code for the caller. - Using a ServiceLocator as you stated.
- Add a static initialization method to the class, and inject all of it's dependencies (as static properties). You would have to call this initialization in your application start.