Closed dominikj111 closed 5 years ago
You should not be reloading on each request. It should only reload when you explicity do ?reload=true
. Do you have reloadApplicationOnEveryRequest
set to true? If so that should be false in 99% of scenarios.
The onReload is intended to be called before setupApplicationWrapper so that you can preform any 'cleanup' operations on beans before they are discarded such as closing sockets, or persisting state etc before they are destroyed etc.
I suppose that when ?reload=true
then isFrameworkReloadRequest()
return true, so I'm reloading at that moment, not on every request.
reloadApplicationOnEveryRequest
is false.
So where I should to create my services properly? In the onApplicationStart
? I got that that function is run only once when the application actually started, but not during reloading. Or is this wrong?
If you are using your own beanfactory then you can use setupApplication
, if you are using DI/1, then that is the default and you can just configure it using the FW/1 settings.
There is more information in the docs: http://framework-one.github.io/documentation/4.2/developing-applications.html#bean-factory-configuration
I don't think this is an issue with FW/1 so can I suggest that we move this to the support channels:
Support: http://groups.google.com/group/framework-one/
Chat: The CFML team Slack has a dedicated #fw1 channel.
Sure, thanks. I've forgotten about setupApplication.
I would like to keep my services in the beanFactory instead of creating them on every request, so I got that proper way is to override
onReload
in the application file, but my services are not kept and the reason is calling ofsetupApplicationWrapper
afteronReload
in the one.cfc. When I swaped these two functions, it start to work as I wanted.As a fix in my application file in the
onRequestStart
, I'm doing this:if(isFrameworkReloadRequest()){ onReload(); }
one.cfc:onReload