Aside from dependency injection and configuration facilities via programmable APIs, Guice provides feature of scoping various classes, depending on their role in the business logic.
As we saw, while developing the custom scope in Chapter 3, Diving Deeper in Guice, a scope comes into picture during binding phase. Later, when the scope API is invoked, it brings the provider into picture. Actually it is the provider which is the key to the complete implementation of the scope. Same thing applies for the web scope.
Whenever we annotate any class with either of servlet scopes like
@SessionScoped, call to scope API of these respective APIs are made. This results in eager preparation of the
Provider<T> instances. ...