[coldbox:12973] Wirebox standalone installation

Hi Guys, can someone please explain how to setup wirebox in a standalone > situation with just application.cfc?

onApplicationStart(), create WireBox with createObject().

For example, when I create wirebox in the application.cfc does it inject itself into the application scope?

If you set set scope registration in the config, yes it will persist itself in whatever scope using whatever key you specify.

wirebox.scopeRegistration = {
   enabled = true,
   scope = "application", // server, cluster, session, application
   key = "wireBox"
  };

You can also manually set it into a scope if you wish.

Does the binder.cfc get called? If so where and how?

You can create the binder.cfc and pass it in on the init of WireBox or you can tell WireBox where the config is located with an instantiation path and it will create it for you.

I want to use mapDirectory. I assume I do that in the binder.cfc.

Yep. You can pretty much do the same stuff in a stand-alone WireBox install that you can do within ColdBox. A couple differences are that your ColdBox settings won't be passed in as properties (though you're free to pass in another struct of properties) and any ColdBox DSL obviously can't be built without an attached ColdBox instance.

Check out the docs for some examples of creating WireBox outside of ColdBox:

http://wiki.coldbox.org/wiki/WireBox.cfm

Thanks!

~Brad

Hi Guys,

Thanks for getting back with me. What would the call be to determine
what wirebox has mapped? Also, when I tried created aliases using the
map function inside the binder that did not seem to work. The only way
I got that to work was to add annotations directly to the components.

Also, I tried injecting some other objects into others. They looked
something like this.

<cfproperty name="ART" inject="model:ART" scope="instance" />

I tried it like this as well and I got the same error.

<cfproperty name="ART" inject="ID:ART" scope="instance" />

Do I have to do something in the binder to use the instance scope?

Thanks,

George Murphy

How are you calling the object you are looking to wire? You will have to use wirebox to retrieve the object and not createObject or new for it to be wired up for you.

injector = createObject("component","wirebox.system.ioc.Injector").init();
espresso = injector.getInstance("model.CoffeeShop");

Check out these to videos I made a while ago. They are both short and should help you get started.


Hope that helps.

Curt Gratz
Computer Know How