Auto reload singletons in DEV

I wanted to revisit this topic and move it to it’s own post so it doesn’t get lost.

Since Coldbox 7, we haven’t been able to use the singletonReload = true setting in DEV; see this post for ref:

As mentioned in that thread, this is a bit of a pain as the framework must now be reinited on every code change to a model that is marked as a singleton.

Is there a way to denote bespoke singleton models (e.g. those in `modules_app’ folder) vs framework specific and/or 3rd party module specific models? Alternatively, is there any hack anyone is currently using to “ignore” the singleton flag in DEV or any other workaround? Or is everybody just reiniting the framework on every dev change?

I’d love to know how to do this. If anyone has a solution to not reinit on every dev change that would be much appreciated.

There was a commandbox cli command -

Coldbox reinit —watch

It’s a file watcher, it would reload when you changed something you needed to reload (got it right 90%) of the time.

Reiniting every request is slow… don’t over reinit :wink:

1 Like