click-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bob Schellink <>
Subject Re: Picocontainer related question.
Date Mon, 05 Apr 2010 03:10:24 GMT
I don't know Pico but for integration I suggest either:

a) a pico factory that can be used in your Pages to lookup services
b) use pico to create your Pages and inject services directly into those pages

For a) you can use a ContextListener at application startup time to configure your pico factory.

For b) you can look at SpringClickServlet on how to use an IOC container to create Pages.

kind regards


On 5/04/2010 2:01 AM, Andrei Ionescu wrote:
> 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* 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:
> but it doesn't seem to have a Fix Version, nor a patch from somebody who
> is expert :(.
> regards,
> Andrei.

View raw message