您的位置:首页 > 编程语言 > Java开发

struts2配置文件加载顺序

2015-10-16 22:24 447 查看

struts2配置文件加载顺序

struts2框架要能执行,必须先加载StrutsPrepareAndExecuteFilter.

在StrutsPrepareAndExecuteFilter的
init
方法中对Dispatcher进行了初始化.

在Dispatcher类中定义的
init
方法内就描述了struts2配置文件加载的顺序

在开发中,后加载文件中的配置会将先加载文件中的配置覆盖。

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加载

1.default.properties文件

作用:定义了struts2框架中所有常量

位置: org/apache/struts2/default.properties

2.struts-default.xml

作用:配置了bean,interceptor,result等。

位置:在struts的core核心jar包.

struts-plugin.xml

它是struts2框架中所使用的插件的配置文件。

struts.xml

我们使struts2所使用的配置文件。

3.struts.properties

就是可以自定义常量。

4.web.xml
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  框架 开发 struts2.0