Application Variable

Why when I do a reinitialize does it not reset this back to the default setting in coldbox.cfc?

That line will only have an effect once: the first time the application is fired up (either after sitting long enough for the application timeout to be met, or on server/CF restart). After that, it will never matter, because the variable (application.class) already exists. A ColdBox reinit does not wipe out whatever you have put into the application scope.

As a best practice should we be putting all application variables in the application storage plugin?

Yes. Use the correct storage plugin for your application/session/client/cookie variables.

You do whatever it is that makes sense for you. :slight_smile: For instance, if you need legacy code to access that data directly from the application scope, I think you may have a good argument to leave it there since the legacy code doesn’t have the plugin.

Generally speaking though, there are benefits to using the scope storage plugins. One of the biggest in my opinion is the ability to isolate your code from external resources for the sake of unit testing. You can mock the application storage plugin to test your code independently of it. Or you can abstract away things like serialization and encryption of the data being stored (such as in the client storage plugin)

Thanks!

~Brad