@Component public class SpringContextUtil implements ApplicationContextAware { @Autowired private static ApplicationContext applicationContext; public static ApplicationContext getApplicationContext() { return applicationContext; } public void setApplicationContext(ApplicationContext applicationContext) { SpringContextUtil.applicationContext = applicationContext; } public static Object getBean(String beanName) { return applicationContext.getBean(beanName); } }
获取spring上下文
猜你喜欢
转载自xinglijun1973.iteye.com/blog/2334838
今日推荐
周排行