1、ContextLoaderServlet
<servlet> <servlet-name>springInitServlet</servlet-name> <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet>
2、ContextLoaderListener
<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
3、ContextLoaderPlugIn
在struts中使用插件的方式调用
<struts-config> <form-beans> </form-beans> <action-mappings> </action-mappings> < message-resources parameter="ApplicationResources" /> <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn"> <set-property property="contextConfigLocation" value="/WEB-INF/applicationContext-action-file.xml" /> </plug-in> </struts-config>
本文详细介绍了Spring框架在Web环境中三种不同的启动方式:ContextLoaderServlet、ContextLoaderListener和ContextLoaderPlugIn。通过具体的配置示例,阐述了每种启动方式的特点和应用场景。
1727

被折叠的 条评论
为什么被折叠?



