I would like to use PicoContainer(alone) in a Click webapplication, but I'm not sure how (Spring looks so much different than Pico to use it as a starting example, and there aren't any books about Pico :( )

Let's say in the Click-examples instead of Spring to use PicoContainer
but with a little change:
- for all the classes in the org.apache.click.examples.service.* there
is also an Interface for each (those actual classes there being only the implementation - maybe even in an "impl" subpackeage) - everywhere the services are used, only the Interface is used, and the implementation is injected, so that the Click Pages are independent of the implementation code. - this would allow to switch the implementation to e.g. a Hibernate implementation for the same example, or to test simpler the Service layer since dependencies would be separated with those Interfaces.

Would this possible with PicoContainer and Click? Any idea how, or maybe an example? PicoContainer is so much smaller and it looks like it's more accepted than Spring in some projects by the management.

Another alternative for decoupling would the Service Provider Pattern supported by the JDK (that META-INF/services/ trick), but it seems to require separate JARs and it still requires discovery code - not like when the implementation would be simply injected.

There's even an old feature request for Pico:
https://issues.apache.org/jira/browse/CLK-384
but it doesn't seem to have a Fix Version, nor a patch from somebody who is expert :(.

regards,
Andrei.

Reply via email to