package com.espeed.yxy.tool; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; /** * 程序名称: EspeedMail_时速邮箱 * 程序版本: V1.0 * 作 者: 深圳市科飞时速网络技术有限公司(0755-88843776) * 版权所有: 深圳市科飞时速网络技术有限公司 * 技术支持: Tech@21gmail.com * 单元名称: 获取springApplicationContext中Bean的工具类 * 开始时间: 2013.10.1 * 程 序 员: 芮瑞 * 最后修改: 2014-02-25 * 备 注:功能主要包括(对企业的增删改查) */ public class SpringFactory implements ApplicationContextAware { private static ApplicationContext context; public void setApplicationContext(ApplicationContext context) throws BeansException { this.context = context; } /** * * @param id要获取的springBean的id * @return */ public static Object getObject(String id) { Object object = null; object = context.getBean(id); return object; } }