How can I read the default application.datasource from 开发者_JS百科my code?
A dump of application does not show me the datasource, and trying to read application.datasource
gives an error.
Try dumping application.getApplicationSettings()
Try re-start the applciation. You can't just dump application and see the datasource. But if you have this set in application.cfc it "should" be working.
component output="false" { this.name = "MyDemo"; this.datasource = "DemoDB"; }
Edit: Nice Tony I didn't know that.
The this scope in the Application.cfc only persists for the duration of the onApplicationStart(), onSessionStart() onRequestStart() etc.
If you want to expose variables, in your onApplicationStart(), simply store the in the application scope.
application.myVariable = myVariable;
精彩评论