getInstance() now accepts either dsl or name via the first argument and initArguments as second argument


The de facto input to all inject attribtues has always been dsl which makes a lot of sense. As such, people always expect to be able to use namespaces like `coldbox:setting;foo` by default anywhere they ask WireBox for something. The notable exception to this is the getInstance() call, which uses "name" as the first argument so the following doesn't work

Now, this is possible by switching to named params like so:

I think defaulting to name back when this was called getModel() made more sense, but there's really no point in not just allowing dsl for everything at this point. If anyone wants to specifically get a model (the exception, not the rule) they can get the old behavior back with

This will also allow for a cleaner syntax when providing init args to your model. I recommend that the first param be set to dsl but the getIstance() get updated to check for "" and if it exists and dsl is not passed, then we just do

behind the scenes which will provide for very nice backwards compatibility since both of these existing ColdBox 5 use cases would continue to work out of the box with zero app changes which probably accounts for 95% of the use cases.

This will technically be a breaking change, so it needs to happen in ColdBox 6.


Luis Majano


Brad Wood




Fix versions

Affects versions