---
title: "Struts2的devMode"
author: "chainhou"
date: "2013-04-10T16:30:48Z"
tags: []
categories: ["开源软件"]
slug: "struts2-devmode"
draft: false
lastmod: "2013-04-10T16:30:48Z"
id: 1845200
url: "https://chainhou.iteye.com/blog/1845200"
---

今天在debug Struts2的源码的时候发现，当在struts.xml中配置了devMode为true时，源码中会把设置以下几项：

        
```java
if ("true".equalsIgnoreCase(props.getProperty(StrutsConstants.STRUTS_DEVMODE))) {
            props.setProperty(StrutsConstants.STRUTS_I18N_RELOAD, "true");
            props.setProperty(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, "true");
            props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE, "false");
            props.setProperty(StrutsConstants.STRUTS_FREEMARKER_TEMPLATES_CACHE_UPDATE_DELAY, "0");
            // Convert struts properties into ones that xwork expects
            props.setProperty(XWorkConstants.DEV_MODE, "true");
        }
```