application.wirebox instance overwritten when application.cfc extends coldbox

My application.cfc begings with the following component definition

Later in my application.cfc I initialise wirebox by doing the following.


I have setup my WireBox.cfc config file to register wirebox in the application scope.

Unfortunately some of the mappings I have setup in my WireBox.cfc are unavailable after the app has loaded.
e.g. application.wirebox.getInstance(‘MyInstance’); causes an error that it cannot find the instance.

After some logging it seems that the following process occurs.

  1. ColdBox.cfc config file is loaded.
  2. Application.cfc is run and in turn my WireBox.cfc is registered into application scope
  3. ColdBox.cfc config is run again??

When I remove the extends=“coldbox.system.Coldbox” from my application.cfc … I get an error because my coldbox event cannot fire…
However my mapping then become available within application.wirebox!!!

I have tried to resolve my situation by setting up wirebox directly in my coldbox.cfc


,wirebox = {
enabled = true,
binder = ‘myapp.config.coldbox.WireBox’

But unfortunately the binder does not load at all in when I do this!

thanks for any help


Are you re-initing the application when you make changes?

Thanks for your reply… I have made a very basic error.

I put the

wirebox = {
enabled = true
,binder = ‘myApp.config.coldbox.WireBox’

In the wrong place in the coldbox.cfc

Moved it into the correct place and it is working fine!!!

Thanks guys!

whenever I post a question online I always seem to figure out the solution straight away!

sorry for wasting your time.

Why are you directly creating WireBox in your Application.cfc? If you are using ColdBox, it will automatically create WireBox for you. The config for it is placed in the /config/WireBox.cfc. WireBox is automatically made available to you via the framework in handlers, views, etc.



ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform: