首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

施用web.xml方式加载Spring时,获取Spring context的两种方式

2012-10-19 
使用web.xml方式加载Spring时,获取Spring context的两种方式:1、servlet方式加载时:【ServletContext?contex

使用web.xml方式加载Spring时,获取Spring context的两种方式:

1、servlet方式加载时:

          ServletContext?context?=?getServletContext(); ??????? ?????WebApplicationContext?applicationContext??=?WebApplicationContextUtils ???????.getWebApplicationContext(context); ????? ????????DataSource?dataSource=(DataSource)applicationContext.getBean("dataSource");?

热点排行