ModelsExternalLocation ??


I wanted to know what is the benefit of using the
ModelsExternalLocation setting in the Coldbox config? It seems you
can already create a mapping in CFAdmin and have an external set of
components shared across apps anyways. Is it really just a variable
stored in Coldbox.cfc to make things easier?


Yes, the models external location is a feature called package scans. You basically give it an array of packages the internal factory (wirebox) will scan for objects. When you request an object via getModel(), wirebox will scan the locations you set IN ORDER. if not found, it will just try to create the object.

This gives you the ability to feed packages into wirebox so you do not have to declare a configuration file for all your objects and dependencies. It is a convention way to get objects and then wire them by “inject” annotations. wirebox supports this as I describing it, but it will also support a configuration approach.

So it is not mandatory, but it just basically accelerates lookups as you are telling the framework where to search in a specific order. If the setting is blank, then it searches the “model” convention in your app first and then the rest of the server if not using aliases.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager: