Message-ID: <1024735513.798994.1386838819327.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_798993_2008399637.1386838819327" ------=_Part_798993_2008399637.1386838819327 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
PicoContainer is a mature dependency injector framew= ork similar to spring-core or Guice. It presents the advantage to be quite = small (~260Ko) and yet very complete.=20
The advantages of dependency injection are numerous=20
Specifically to IzPack, PicoContainer allows=20
With pico, you create and manage your own container. Once created, you c= an=20
Here you create a new container, add CliAnalyzer as a dependency and get=
the instance of CliAnalizer.
The container is configured to "ca= che" dependencies. Meaning, it insures that there is only one instance= of this component created. It is the same as a Singleton in Guice.
Expect some particular cases, you don't need to lookup for your componen= t using the container. Exceptions are when component are constructed dynami= cally like panels. In this case, we add the panel and get the instance from= the compiler.=20
In most case, you should use injection to get dependencies.=20
Two injections methods have been used primary used.=20
PicoContainer supports many types of inje= ctions but the preferred way is to pass dependencies in the constructor.
For example, given the following class :=20 =20 =20
The instance of AClass will be constructed using the instance of CliAnal= yzer.=20
It is used to create component which need informations from xml (like Au= tomatedInstallData). All providers are available in packages *.container.pr= ovider=20
PicoContainer gives the possibilities= to inject primitives (String, Integer, ...). They are resolved by name and= it is used to inject the install file name in components.
If you create a component, you can add it to the container so that it wi= ll be avaible as a dependency.=20
On the compiler, the container is configured by the class co= m.izforge.izpack.compiler.container.CompilerContainer=20
On the installer, there are several containers :=20