Re: [picocontainer-dev] Trying an experiment to kill off ContainerRecorder (Nano)
Paul Hammant <[email protected]>
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Mike,
You should still be able to do ..
> pico.registerComponent(PicoContainer.class, new
ImmutablePicoContainer(pico));
Either at application (Caching) or session and request levels
(ThreadLocal/Storing).
Its inherently session safe as it was before.
- Paul
On May 22, 2008, at 11:50 PM, Michael Rimov wrote:
>>>> Where do you use instance registrations dude ?
>>>
>>> //Example...
>>> public class Action {
>>>
>>> public Action(HttpServletRequest request, HttpServletResponse
>>> response)
>>> {
>>> //.....
>>> }
>>> }
>>>
>>> pico.addComponent(Action.class);
>>> pico.addComponent(HttpServletRequest.class, request);
>>> pico.addComponent(HttpServletResponse.class, response);
>>> pico.addComponent(HttpSession.class, request.getSession(true));
>>> Action action = pico.getComponent(Action.class);
>>>
>>
>> Could you use this
>> http://fisheye.codehaus.org/changelog/picocontainer/java/2.x/trunk/nanoextr
>> as?cs=4406
>> instead ?
>>
>> And the following once-once composition fragment?
>>
>> sessionContainer.addAdapter(new
>> ServletRequestContainerFilter.SessionInjector())
>>
>> requestContainer.addAdapter(new
>> ServletRequestContainerFilter.RequestInjector())
>> requestContainer.addAdapter(new
>> ServletRequestContainerFilter.ResponseInjector())
>
> Yeah, I suppose I could replace all instance registrations with
> another layer of
> adapters... I currently have about 5-6 other instance registrations
> that I use:
> Things like the request locale, etc, and yes, theoretically, they
> all could be
> replaced with adapters:
>
> But beyond me, you're going to further have a usability problem with
> reworking
> NanoWAR since its built around a "typical" composition script, and
> people often
> fall back to an instance registration when they cannot immediately
> find an
> adapter for what you're looking for.
>
> One of the biggest things that Pico has that (in my mind)
> differentiates it from
> Spring is the power to take over instantiations and register it
> yourself.
> What's one of the most common questions people try when they're
> kicking Pico
> tires:
>
> pico.registerComponent(PicoContainer.class, new
> ImmutablePicoContainer(pico));
>
> Yes, we can take the spring route and disallow instance
> registrations as the
> request level -- forcing everything back into a factory provider
> object of some
> sort, but I'm very gun shy of this because I can think of a whole
> pile of things
> that the typical user would want to register by instance.
>
> -Mike
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email