In this chapter, we have leveraged config injection, an extended version of constructor and method injection, to improve the UX of our code, primarily by handling the environmental dependencies and config separately from the contextually significant dependencies.
While applying config injection to our sample service, we have decoupled all possible packages from the config package, giving it more freedom to evolve over time. We also switched most of the logger usage from a global public variable to an injected abstract dependency by removing any possibility of a data race relating to the logger instance and enabling us to test logger usage without any messy monkey patching.
In the next chapter, we will examine another unusual form of dependency injection, called Just-in-time (JIT) dependency injection. With this technique, we will reduce the burden associated with dependency...