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

spring 3中用注解后怎么直接取servlet中取容器bean

2012-10-30 
spring 3中用注解后如何直接取servlet中取容器bean在SPRING 3中,都用注解了,同样出现的问题是,比如要在ser

spring 3中用注解后如何直接取servlet中取容器bean
在SPRING 3中,都用注解了,同样出现的问题是,比如要在servlet中去取得
容器中受spring管理的bean的方法,如何搞法,没了XML配置文件,其实方法很简单,
跟之前用XML时候是一样的,比如:

ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());  
     
  LeaveDao leavedao=(LeaveDao) context.getBean("leaveDao");

热点排行