java - using and understanding the picoContainer -
I am trying to use Pico Container in my project. I know very little about it but want to give it a shot.
As I understand, I have to make a Pico Container and Register Component with it. I did this
Public Fixed Pico Container getPicoContainer () {Final MutablePicoContainer Pico = New DefaultPicoContainer (); Pico.registerComponentImplementation (X.class); Pico.registerComponentImplementation (A.class); Pico.registerComponentImplementation (C.class); Pico.registerComponentImplementation (V.class); Pico.registerComponentImplementation (T.class); Pico.registerComponentImplementation (D.class); Pico back; }
Now my problem is that to get another component to another component, it should have a handle in the pico to access any component it needs to do
a juicer = pico.getComponent (eclus);
So, for each of them in constructor, I have to pass in the pico object? I can easily change it with a factory. Then what's the matter? I'm sure I'm missing something here to appreciate any help
Normally the main There should be a factory for containers somewhere. For the app alone this probably will be the "public static zero main entry (entry)" point for the web app, it will be the front controller servlet or filter or reference listener (Pico's support category for the audience case). Then at the entry point, you configure the container as "above the public stationary Pico Container getPicoContainer ()" in the manner described above, you must give control to the entry point in the container. The best way to implement the lifecycle interface () should be the component of at least one container, then you start the container and everything is wired. In general case you should not use the container next to the entry configuration And things like special factories or limits of transactions should also be included.
Comments
Post a Comment