May 2018
Intermediate to advanced
310 pages
6h 18m
English
As you already know, @Autowired is the magic word that makes our lives easier. We inject the proper instance for the field and make it available in our code. Field injection is easy to do and very popular. The code we have is clear and easy to read and maintain. But there is something you should know about it!
Let's consider injecting our dependencies through the constructor. If we have one dependency, we will inject constructor that have for example one parameter. As the number of dependencies rises, the number of constructor parameters rises, too. Fortunately, this isn't a problem in Kotlin, where we have single-line constructors. At some point, you will realize that by injecting so many dependencies, you ...
Read now
Unlock full access