jasperblues/Typhoon — pull request #50 by cesteban (2013-08-13 09:00:42+00:00)
Title: Singleton circular

Sorry for the late reply! Before sending the pull request I wanted to do some more testing. These are my conclusions:

* The failing test I'm providing does not expose a bug: the problem appears only when you mix initializer injection and property injection in long cycles involving singletons, and it is documented that circular dependencies are only supported with property injection.

* However, it would be extremely useful for me to be able to use initializer injection in some links of these kind of chains. Typhoon 'almost' support this: you can use initializer injection in isolated links, but when singletons are involved, sometimes you end up injecting several different instances of the same singleton.

* The change I made helps with the singleton multiplicity problem.

* Although initializer injection of circular dependencies is still not supported, the change is basically a sanity check, so it shouldn't be harmful anyway.

I know the change is kind of a hack for a feature that is not even supported in the first place, but it is being very helpful in my everyday use of Typhoon. I hope you can find it helpful as well.

Note: To see the test failing, you need to bring back [self buildInstanceWithDefinition:definition] in TyphoonComponentFactory.m:250