Skip to content

Eager vs. Lazy Instantiation

brian428 edited this page Nov 14, 2012 · 5 revisions

Back to Advanced IoC Configuration

By default, dependency providers are created lazily. This means that the dependency will not be created by DeftJS until another object is created which specifies that dependency as an injection.

In cases where lazy instantiation is not desired, you can set up a dependency provider to be created immediately upon application startup by using the eager configuration:

Deft.Injector.configure({
  notificationService: {
    className: "MyApp.service.NotificationService",
    eager: true
  }
});

Next: Constructor Parameters

Clone this wiki locally