struts2中配置文件的加载顺序

struts2 配置文件 由核心控制器加载 StrutsPrepareAndExecuteFilter  (预处理,执行过滤) 
         
  init_DefaultProperties(); // [1]   ----------  org/apache/struts2/default.properties 
            init_TraditionalXmlConfigurations(); // [2]  --- struts-default.xml,struts-plugin.xml,struts.xml
            init_LegacyStrutsProperties(); // [3] --- 自定义struts.properties 
            init_CustomConfigurationProviders(); // [5]  ----- 自定义配置提供
            init_FilterInitParameters() ; // [6] ----- web.xml 
            init_AliasStandardObjects() ; // [7] ---- Bean加载 


结论 :
default.properties 该文件保存在 struts2-core-2.3.7.jar 中 org.apache.struts2包里面  (常量的默认值)
struts-default.xml 该文件保存在 struts2-core-2.3.7.jar  (Bean、拦截器、结果类型 )
struts-plugin.xml 该文件保存在struts-Xxx-2.3.7.jar  (在插件包中存在 ,配置插件信息 )


struts.xml 该文件是web应用默认的struts配置文件 (实际开发中,通常写struts.xml ) ******************************
struts.properties 该文件是Struts的默认配置文件  (配置常量 )
web.xml 该文件是Web应用的配置文件 (配置常量 )


* 后加载文件中struts2 常量会覆盖之前加载文件 常量内容 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值