On this journey, we've learned dependency injection concepts in Java 9, Spring, and Google Guice, with the help of examples.
In Chapter 3, Dependency Injection with Spring, and Chapter 4, Dependency Injection with Google Guice, we came across the word scope, which is a very important element of Spring beans and Google Guice. So, let's understand what a scope is, and why it is important when talking about dependency injection.
In this chapter, we will first learn about various scopes provided by Spring, and how they can be defined for Spring beans. We will also learn the relation between bean scope and dependency injection. Finally, we will look into the scopes available in Google Guice. The topics we are going to cover are as follows:
- Introduction to bean scopes in Spring
- How to define a bean scope
- Dependency injection and bean scopes...