Application.cfcand if found, it will execute it for you implicitly. This file is used to define the following:
thisscope and in the pseudo-constructor of the object.
applicationscope can be leveraged for global persistence. Also note, that because it is instantiated on every request, you have the potential to change settings and events on a per-request basis if needed. Great use cases for this can be the following:
Application.cfcalso acts like a big event listener waiting for the ColdFusion server engine to call its methods in callback fashion. You can listen to when an error occurs to even when a missing template is requested and much more. If I am missing some here, please refer to the latest documentation for the latest updates: https://cfdocs.org/application
onApplicationStartevent is broadcast. It only happens once, until your application times out, the process is restarted, or the computer is restarted.
onRequestStart()as a before advice and the
onRequestas an around advice over the request. You must
includethe requested page or the page will never be processed
eventNamethat generated the exception.
targetPagethat the abort came from.
Application.cfc, with a unique name which defines the separate ColdFusion applications. Anything in that directory and sub-directories will be considered part of the application.
this.nameproperty as the unique name for it. It can contain the variables scopes like
clientwhich are unique per this reservation name. This way two ColdFusion applications can have different persistence variable scopes and can even be embedded between each other:
applicationscopes. The application is reserved for a specific duration which is defined using the
this.applicationTimeoutproperty or defined in the Administrator. Once it expires, the engine will purge it from memory and recreate it fresh.