[Coldbox-3.5.1] Best way to put ColdBox setting into ColdSpring component?

Hi, what is a good way to insert a ColdBox setting value (from the “settings” struct in ColdBox.cfc) into a component managed in my ColdSpring file?

I have a component (instantiated via ColdSpring) that manages sessions. I’d like to place my timeout in the ColdBox.cfc settings area, but I need it in the component. I’m not sure if I can call getSetting() inside the component. Even if that is available to me, I don’t like that dependency. I’m considering just putting the timeout value in ColdSpring, and having it injected into the component that way, but I’d rather keep the value in ColdBox.cfc if thats possible.


You can create a config bean and then inject that in your CS object.

There are multiple ways to do this. You can pass the setting as a constructor-arg as well.


Yes I have a config bean already, and I do inject that into some components. But now I was trying to put a setting into the settings struct in ColdBox.cfc and then access it from a component. I’ll just store it in the ColdSpring XML file instead if there is not a way to access the ColdBox settings.

Did you look at the link I sent? You can pass those Coldbox settings into your CS beans without having to hard code the values.