Firstly, running onApplicationStart()
no more restarts the application than running an onClick()
mouse-click event handler causes your mouse button to depress. onApplicationStart()
is called as a result of the application starting, not the other way around.
Secondly, Application.cfm has nothing to do with the application lifecycle, it is merely a CFML file that is included at the beginning of every request. it is more closely associated with onRequestStart()
than onApplicationStart()
: the file is, unfortunately, misnamed. Its counterpart onRequestEnd.cfm
demonstrates this.
I presume your requirement here is to re-initialise your application scope, yes? Do you have all your application-scope setting isolated in a specific CFML file, eg: applicationSettings.cfm
, and then have logic like this in your Application.cfm
:
// Application.cfm
if (!structKeyExists(application, "inited")){
include "applicationSettings.cfm";
}
(then as a last thing in applicationSettings.cfm
set application.inited
to true
).
If so you simply need to modify your condition to include your URL reinit variable, eg:
if (!structKeyExists(application, "inited") || structKeyExists(URL, "reinit")){
include "applicationSettings.cfm";
}