RE: [picocontainer-dev] circular refs.
Jörg Schaible <[email protected]> Fri, 4 Jul 2008 16:26:24 +0200
| Newsgroups | gmane.comp.java.picocontainer.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Paul,
Paul Hammant wrote:
> Mike went through JIRA updating things (thanks Mike).
>
> One is - http://jira.codehaus.org/browse/PICO-188
>
> It's about circular refs. It turns out that we always supported
> circular refs unwittingly. If you did Implementation hiding,
> then the
> circular was possible. Rather than suggest to users that adding
> ImplemementationHiding must be part of the CAF chain for this, I've
> added a characteristic that allows it to specified as you're adding
> the component:
>
> @Test
> public void circularIsPossible() {
> DefaultPicoContainer pico = new DefaultPicoContainer(new
> Caching().wrap(new SetterInjection()));
>
> pico.as(Characteristics.ENABLE_CIRCULAR).addComponent(IFish.class,
> Fish.class); pico.addComponent(IWater.class, Water.class);
> IWater water = pico.getComponent(IWater.class);
> IFish fish = pico.getComponent(IFish.class);
> assertNotNull(water.getFish());
> assertNotNull(fish.getWater());
> }
> It does not matter which component (in a circular log jam) that you
> specify as ENABLE_CIRCULAR, it amounts to the same thing -
> HiddenImplementation will be in the CA chain for that component.
>
> Thoughts?
IMHO a good idea to enable this as feature for a single component instead of using internally proxies for all components (which was in fact the reason why we did not use it by default in Pico 1.0 IIRC).
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email