RE: [coldbox:17057] Re: [3.5.3] AOP, DI, and FrameworkSupertype

When you inject a provider, the actual dependency is not being injected which means it most likely isn’t even being created yet. The provider is a placeholder object or mixin method, that when asked, will find WireBox from its scope registration and ask it for the dependency at that time. There are two main benefits to providers. The first is preventing scope-widening injection by not creating hard references to your dependencies in your object. The second is deferring the creation of the dependency until you need it. You appeared to be having issues with circular dependencies, so Luis suggested using a provider to defer the need to actually create the dependencies until they were actually used.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I get the concept behind a provider, but I’m unclear about how to create them specifically for those 3 examples I provided. Any help on those would be greatly appreciated.

I didn’t have circular dependencies, just dependencies that depended on modules , plugins, and settings being initialized. It seems that the AOP processing and injections happen before those.

Thanks!