[Coldbox4 - wirebox] put and reference components in the application scope

I have created a new file and wish to have the component/functions available in the application scope.

In wirebox, I have:
map(“TextTest”).to(“global.cfc.TextTest”).into(this.SCOPES.APPLICATION).asEagerInit(); (I currently have added .asSingleton():wink:

and this seems to work. When I do a dumpVar of the application scope, I see a line that says wirebox. Under that, I see:
wirebox:texttest (note the colon between the two words)

and in that, I see "component global.cfc.TextTest. Under methods, I see the function that I want, CLEANTEXT.

yay!

However, all attempts at referencing this from the file has been unsuccessful. I’ve tried dumpVar and from the .cfm file.

Did I do this correctly in wirebox? If so, how do I reference it?

thank you.

daniel

How are you trying to access it? If you asked Wirebox to create/persist it, you need to ask Wirebox any time you want it with just getInstance(). If you are wanting to do your own home-spun persistence, you might as well just store it in application yourself. I’m not sure how your app works, but what you’re doing just seems a little wrong. Why does your application need the object in the application scope? If it’s a singleton, just add the “singleton” attribute to the component.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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