`
gstarwd
  • 浏览: 1488225 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

ContextLoaderListener VS. ContextLoaderServlet

    博客分类:
  • SSH
阅读更多

    一旦ContextLoaderServlet或ContextLoaderListener初始化成功,所有JavaBean实例将会被创建(除非开发者改变了ApplicationContext的默认行为,比如显式设置延迟装载行为)

 

但是他们有细微的区别:

 

   与BeanFactory相比,ApplicationContext 更具优势。因为通过ContextLoaderServlet或ContextLoaderListener能够自动创建ApplicationContext实例。当然,开发者也可以手工创建 ApplicationContext实例。对于实现了Servlet 2.4规范的Web容器而言,可以同时使用ContextLoaderServlet或ContextLoaderListener。Web应用启动过程中将自动初始化监听器,而ContextLoaderListener就是监听器。对于实现了Servlet 2.2规范的Web容器而言,只能够使用ContextLoaderServlet。对于一些实现了Servlet 2.3规范的Web容器而言,也可以使用ContextLoaderListener

 

 

还有个叫做ContextLoaderPlugin ~

下一集继续该系列~

 

爆发吧小宇宙~~之深入了解Spring的启动方式!

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics