concept demand in category gwt

appears as: demd
GWT in Action

This is an excerpt from Manning's book GWT in Action.

In this example, you create an Injector object based on the dependency injection module MyAppModule. Then you request a Computer object from the Injector object created in the bootstrap. This type of injection is called on demand, and it’s pretty much like the factory class we previously looked at. On-demand injection is just one of the types of injection that we’re interested in.

GIN has the same types of injection as Guice: on-demand, constructor, method (setter), and field. We’ll use each of those dependency-injection methods in our photo application. Specifically, we’ll inject the following:

  • Presenters into the application via on-demand injection
  • On-Demand Injection

    Inside the photo application, you’ve already seen some on-demand injection because we bootstrapped the injector in the startup code, but we’ll also use on-demand injection to inject our presenters. The relevant parts of the application are shown in the following listing.

    Listing 16.7. Dependency injection in the photo application

    At you on-demand inject one of the presenters, in this case the PhotoListPresenter, which is responsible for controlling the photo list view.