Home > Guides > Core Developers Guide > devMode |
Please turn this option off before deploying application to a production environment - it can expose sensitive data of your application!
Struts 2 has a setting (which can be set to true
or false
in struts.properties) called devMode (= development mode). When this setting is enabled, Struts 2 will provide additional logging and debug information, which can significantly speed up development.
You can also set this constant in your struts.xml file: <constant name="struts.devMode" value="true" />
.
This is the preferred method. See Constant Configuration for more information.
struts.i18n.reload = true
struts.configuration.xml.reload = true
By default, the development mode is disabled, because it has a significant impact on performance, since the entire configuration will be reloaded on every request.
If you experience slow page rendering when devMode
is on it's mostly because Freemarker cache is disabled during devMode
. You can explicit enable cache and any other options disabled by devMode
, see example below:
<constant name="struts.devMode" value="true" /> <constant name="struts.i18n.reload" value="false"/> <constant name="struts.configuration.xml.reload" value="false"/> <constant name="struts.freemarker.templatesCache" value="true"/> <constant name="struts.freemarker.templatesCache.updateDelay" value="120"/> <constant name="struts.freemarker.mru.max.strong.size" value="120"/>
As you can see, you can switch devMode
on and still have production options on as well.
Please remember to use production optimized options which can be different than these used during development (especially cache related)!