Annoyance but solved

Hello All,

I just spent some time being very annoyed by injection and trying to get custom settings and thought I’d post here in case anyone else experiences it.

In coldbox.cfc I have something like the following:

// custom settings settings ={ myAppSettings ={ Datasource = "myDSN", AdminEmail = "" } }

Then I created a datatest.cfc in model and called it with a simple handler and view.


component accessors=“true”{
// cannot view the properties of this injection before the init()
property name=“myAppSettings” inject=“Coldbox:setting:myAppSettings”;

//writeDump(var=variables.myAppSettings,label=“before init”); // In here myAppSettings is null, hasn’t been constructed yet. No data available


  • Constructor
    datatest function init(){
    return this;


  • getAll
    function getAll(){

//writeDump(var=variables.myAppSettings,label=“in function”); // data now available to use

tmp = queryExecute(
Select top 10 firstname, lastname
from tEmployee
{ datasource = variables.myAppSettings.Datasource }

return tmp;


The issue I had for the longest time was when I was trying to view the returned settings object right below the injection.
The thinking is while setting everything up make sure the data is there before adjusting the rest…

I kept getting “Component [models.datatest] has no accessible Member with name [MYAPPSETTINGS]”

Much head knocking and internet searching ensued.

It was because I was trying to resolve the custom settings before the model had finished initializing.
When I waited to look at it in the function it performed as expected then was able to actually use the value.

So, order of operations is very important.
This is probably not something that people even think about now once they are used to working with it but it burned a few of my hrs.

hopefully this helps someone,