获取bean的方式
来源:互联网 发布:淘宝网下载到电脑上 编辑:程序博客网 时间:2024/09/21 09:21
1、监听器中获取
public static Object getBean( ) {
WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext();return context.getBean(“userDao”);
}
2、ApplicationContext context = new ClassPathXmlApplicationContext("/config/applicationContext.xml", "/config/applicationContext-dao.xml");
Scheduler scheduler = (Scheduler) context.getBean("quartzScheduler");
3、 servlet获取
private Object getBean( ) {
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
return ctx.getBean(ParameterService.class);
}
4、过滤器中获取
public void init(FilterConfig filterConfig) throws ServletException {
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(filterConfig.getServletContext());
sysUtil = ctx.getBean(SysUtil.class);
}
- 获取bean的方式
- spring 获取bean的方式
- spring bean的获取方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring获取Bean的几种方式
- Spring中获取bean的方式总结
- spring中bean的获取方式总结
- Spring中获取bean的方式总结
- spring获取bean的几种方式
- Spring获取bean的三种方式
- spring 获取bean的几种方式
- spring 获取Bean的几种方式
- Spring获取bean的几种方式
- Spring中获取bean的方式
- erl小计(一)
- 启动界面黑屏解决
- list删除重复记录
- 删除一个数据库中所有数据的方法
- 为什么网上下载的office软件都不能用啊
- 获取bean的方式
- hibernate中的id特殊属性hilo剖解(多用于继承关系)
- 自定义BUTTON!
- win7下QWT在VS2008中的安装使用
- paip.多个TOMCAT共存在一台主机上配置方法
- java.lang.IllegalArgumentException: parameter must be a descendant of this view
- MySQL SHOW INDEX语法的实际应用
- 在web和非web环境都可以使用的属性文件属性读取java代码
- 自定义MPMoviePlayerController的界面