Application-scoped variables should probably become Coldbox settings or WireBox singletons, depending on what the variable is. I’d need to know more about what you’re putting in the session scope. but you can create an onSessionStart handler in ColdBox. If you are storing CFCs like user CFCs in the session scope, then check into WireBox’s scopes where it can do this for you.
As far as the functions in your Application, I’d need to know what they are. Chances are they can be placed in a utility class in the models folder and injected wherever you need them.
The Coldbox handlers such as onSessionStart run inside of the Application.cfc’s onSessionStart method. There is boilerplate there that taps the framework to execute it’s handlers. The benefit is your Coldbox handlers run inside of the framework and have proper access to helper methods, view renderings, injections, etc.
What is the advantage to making them coldbox settings,
The are encapsulated inside the controller so the framework can control them
they are reloaded automatically when you reinit the framework
They can be influenced by environment detection
You can use helpers in the coldbox.cfc to access env vars and java system properties to set them
They are injectable by Wirebox
They are accessible in every handler, view, layout, and interceptor via the getSetting( ‘name’, ‘default’ ) method
They can be mocked more easily in unit and integration testing
can a Wirebox Singleton represent a single unique value like a string or are they always classes?
Any WireBox mapping can be a singleton and a mapping can point to anything including a static variable, but typically singletons means a CFC instance. There’s no point in having a singleton string. Just use a Coldbox setting.