Off-the-shelf injection with Wire

The Go Cloud project is an initiative that intends to make it easier for application developers to deploy cloud applications on any combination of cloud providers seamlessly. The integral part of this project is a code generation-based dependency injection tool called Wire.

Wire is a good fit for our example service as it promotes the use of explicit instantiation and discourages the use of global variables; just as we attempted to achieve in our refactoring in previous chapters. Additionally, Wire uses code generation to avoid any performance penalties or code complexity that can result from the use of runtime reflection.

Perhaps the most useful aspect of Wire for us is its simplicity. After we understand a few simple concepts, the code we have to write and the code that is generated is reasonably straightforward.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.190.156.93