Wirebox Setup

I am playing around with Wirebox for the first time, and am having a bit of difficulty…

So, the code I have so far is this in Coldbox.cfc under configure,

//WireBox Integration
wireBox = {
enabled = true,
binder=“config.Binder”,
singletonReload=true
};

This under config.Binder…

component
extends=“coldbox.system.ioc.config.Binder” output=“false”
{
function configure()
{
map(“userService”)
.to(“model.UserService”);
}

}

and in handlers.Request…

function index(event){
var rc = event.getCollection();

var user = userService.get();
}

And I am getting UserService is undefined…Any thoughts? Thanks in advance!

You need to add the property to the component.

Regards,

Andrew Scott

http://www.andyscott.id.au/

So, this is the proper syntax then?

property name=“userService” inject;

Yes you need that for wirebox to inject the dependency.

Regards,

Andrew Scott

http://www.andyscott.id.au/