[ColdBox 3.5.3] How to best make a helper component available?

First, let me say I read about includeUDF() but I’m not sure that will work in this situation.

I have a “sessionBroker” component that I use to read & write from the session. So in my views and event handlers I would use this:

sb.write(‘firstName’, ‘Bob’)
instead of

session.firstName = ‘Bob’

So I’m trying to figure out how to make this component available to the views & event handlers. I don’t think includeUDF() helps me here because I want the views & handlers to use the instantiated component. The component will be declared in ColdSpring and may have been passed configuration information (i.e. where to store the session values) when it was instantiated. If i could use includeUDF like this it would work:

<cfset sb = getPlugin(‘ioc’).getBean(‘SessionBroker’) />
<cfset includeUDF(sb) />

But I don’t think it works that way. I was thinking I may be able to do something like this?


<cfreturn getPlugin(‘ioc’).getBean(‘SessionBroker’)>

Then somewhere else (BTW I’m not sure where this “somewhere else” should be):

<cfset includeUDF(“sb.cfm”) />

Then in my views I could use:
getSB().write(‘firstName’, ‘Bob’)

Any suggestions? Thanks.

Jake Churchill pointed me to the ApplicationHelper.cfm file. This works perfect! I just added one line and now it’s available everywhere:

<cfset sb = getPlugin(‘ioc’).getBean(‘SessionBroker’) />