November 2018
Intermediate to advanced
346 pages
8h 12m
English
Given that config injection is an expanded form of constructor and method injections, the advantages of the other methods also apply here. In this section, we will discuss only the additional benefits that are specific to this method.
It's excellent for decoupling from a config package—When we have a config package that loads from a single place, such as a file, then this package tends to become a dependency for many of the other packages in the system. When considering the Single responsibility principle section from Chapter 2, SOLID Design Principles for Go, we recognize that the more users a package or object has, the more resistant and/or difficult it is to change.
With config injection, we are also defining ...
Read now
Unlock full access