Provider onMissingMethod Proxy
Thanks to our ColdBox Evangelist, Brad Wood, we have a feature in our Providers that you can leverage its onMissingMethod()
to proxy calls into the provided object itself. So let's say our provided object has a method called sayHello()
, then with an injected provider you must do this:
That is great, but you can proxy calls into the provider itself by removing the extra get()
call and doing this:
The WireBox provider object (wirebox.system.ioc.Provider
) has an onMissingMethod()
function that will take all missing method calls and proxy them to the provided object. Now, this is great but be ready to lose on performance if you use this approach. That is the only caveat to this approach, is that you will be impacted by performance, not crazy, but try it.
Last updated