We need you!


The IzPack documentation needs work, and you are invited to edit it!

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

PicoContainer is a mature dependency injector framework similar to spring-core or Guice. It presents the advantage to be quite pretty small (~260Ko) and yet very complete.

Two injections methods have been used primary used.

  1. Injection by constructor.
  2. Injection by provider
Dependencies definitions

With pico, you create and manage your own container. Once created, you can

  • Add component to the container
  • Get component from the container

Here you create a new container, add CliAnalyzer as a dependency and get an instance of CliAnalizer.
The container is configured to "cache" dependencies. Meaning, it insures that there is only one instance of this component created. It is the same as a Singleton in Guice.

Injection by constructor :

(see http://www.picocontainer.org/constructor-injection.html)
PicoContainer supports many types of injections but the preferred way is to pass dependencies in the constructor.

For example, given the following class :


The instance of AClass will be constructed using the instance of CliAnalyzer.

Injection by provider :

(see http://www.picocontainer.org/providers.html)
Provider gives more flexibility to construct the component instance and it is useful to do some works prior to instantiation.

It is used to create component which need informations from xml (like AutomatedInstallData). Construction of those components are made by providers.

  • No labels