[coldbox-4]: How to use provider:ColdBoxRenderer

Guys,

When browsing ContentBox source code (\modules\contentbox\models\comments\CommentService.cfc), I found the use of provider:ColdBoxRenderer which is something interesting and new to me. So, I wrote my own model in order to understand how provider:ColdBoxRenderer works.

`

// models/Test.cfc
component {

property name=“renderer” inject=“provider:ColdBoxRenderer”;

function init() {
return this;
}

function foo() {
return renderer.get().renderLayout(view = “/test/myView”);
}

}

// handlers/Test.cfc
component {

function foo(event, rc, prc) {
local.test = getModel(“Test”);
writeDump(local.test.foo());;
event.noRender();
}

}

`

When I called http://localhost/index.cfm?event=test.foo, I got the following error:

Type: Builder.DSLDependencyNotFoundException
Messages: The DSL Definition {REQUIRED={true}, DSL={id:ColdBoxRenderer}, NAME={}} did not produce any resulting dependency The target requesting the dependency is: ‘ExplicitCall’

Could you someone explain to me what did I miss?

Thank you!

I think you’ll find its: provider : coldbox : renderer (I added spaces to clarify - remove them in your code).

Actually what he has is correct already, unless it has changed.

Perhaps they both work, but littered throughout my source is property name=“renderer” inject=“provider:coldbox:renderer”;

Yeah, I think it has changed and that this being from Contentbox is why it might not work in ColdBox 4.x as I haven’t done programming in either for awhile I know I used this in my blog without issues and Contentbox uses it. So I would maybe check to see if this is being moved and tested in ColdBox 4.x and see if your suggestion works for him.

Hey guys,

property name="renderer" inject="provider:coldbox:renderer";

is working. Thanks so much.