日期:2014-05-17  浏览次数:20688 次

Struts2读取配置文件时属性值是否会覆盖
我知道是struts2读取配置文件的顺序是:

struts-default.xml、

struts-plugin.xml、

struts.xml、

struts.properties、

web.xml

如果在 struts-plugin.xml中定义了

<constant name="struts.objectFactory.spring.autoWire" value="type" />

但是在sturts.xml中定义了

<constant name="struts.objectFactory.spring.autoWire" value="name" />

那么最后自动注入属性时是按什么注入的,如果后面配置文件会把先读取的文件的属性值给覆盖掉,为什么会覆盖掉呢?最好给解释下原因,或者给个相关连接也行,谢谢!!!

------解决方案--------------------
1 struts.properties先 读取
2 然后struts-default.xml
3 再struts.xml

1中没有,就用2的,
1中没有,就用2的,3有就覆盖
1中有,3也有就覆盖



------解决方案--------------------
这,这,这,这,还真没研究过。