RE: [coldbox:4364] Circular Dependency Injection

Well, technically there was the third option of keeping LightWire but
"lazy loading" one of the dependencies from within the other object on
its first use after their init via the bean factory.



Sorry - I clearly wasn't paying attention. Did someone suggest using ColdSpring for circular constructor dependencies? Does it support that? I'd be fairly surprised as it's kind of a problem that as far as I can think can't genuinely be solved (as opposed to hacking round it, and making assumptions which could trip up people using the engine).

Best Wishes,

ColdSpring does not support circular dependencies on constructor arguments!

You must use setter dependencies in this case.

For the record I don’t need the constructor injection (although that was my original attempt) and I’ve been trying to make the setter injection work, thus far unsuccessfully. Am I doing that wrong or do I need to write some code to lazy load as Brad suggested?

In ColdSpring, it would look something like this…

I’ve not use LightWire, so I’m not sure how it would be done there.