获取Spring对象的公共方法
来源:互联网 发布:局域网网络行为监控 编辑:程序博客网 时间:2024/06/06 07:02
第一种方式(in hedao):
/** * 获取Spring对象的公共方法 * * @author luoyue * */public class BeanHolder { public static Object getBean(String beanId) { WebApplicationContext ctx = WebApplicationContextUtils .getRequiredWebApplicationContext(ApplicationContext .getContext().getServletContext()); return ctx.getBean(beanId); }}
第二种方式(in yingbo):
ApplicationContext ac = new FileSystemXmlApplicationContext("E:/Workspaces/MyEclipse 10/crawler/resources/applicationContext.xml");TaskDistributor taskDistributor = (TaskDistributor)ac.getBean(beanId);
beanId 为spring配置文件中javabean的id
- 获取Spring对象的公共方法
- spring aop获取目标对象的方法对象
- spring aop获取目标对象的方法对象(续)
- 获取Spring的Bean持有容器对象的方法
- Spring框架中获取dataSource对象的方法
- Unity实例化对象的公共方法
- spring aop获取目标对象的方法对象及方法上的注解
- spring aop获取目标对象的方法对象(包括方法上的注解)
- spring aop获取目标对象的方法对象(包括方法上的注解)
- Spring 公共方法
- 获取spring的实例对象
- Spring中 interceptor 获取方法级对象
- spring非IOC容器中的对象获取IOC容器中对象的方法
- 获取spring容器的方法
- spring 获取 ApplicationContext的方法
- Spring获取ApplicationContext的方法
- 获取Spring容器的方法
- Class对象的获取方法
- VMware虚拟机中安装redhat9.0 操作系统(初学linux,很详细)
- 一个字母引起的错误
- HDU 4579 Random Walk (解方程)
- HDU 4585——Shaolin
- IBM的新蛋糕:开源
- 获取Spring对象的公共方法
- c/c++ 函数指针的用法
- ECAT_CheckWatchdog()
- 读取字符的总结
- 11-mysqli预编译执行dml语句
- 深入浅出Node.js(二):Node.js&NPM的安装与配置
- 开源项目托管站点SourceForge, Google Code, CodePlex
- for in 循环(JavaScript)
- hdu——Rotten Ropes