一、建一个SpringUtil类 package com.ceopen.eoss.spring; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; public class SpringUtil implements ApplicationContextAware { private static ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext context) throws BeansException { SpringUtil.applicationContext = context; } public static Object getBean(String name){ return applicationContext.getBean(name); } } 将SpringUtil注入spring配置文件 <bean id="spring" class="com.ceopen.eoss.spring.SpringUtil" /> 二、如下取得注入Spring 中的对象 ICBMission icbMission = (ICBMission)SpringUtil.getBean("ICBMission");