标签:
public static Object getBean(String beanName){ ApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); return context.getBean(beanName); } public static ServletContext getServletContext(){ WebApplicationContext context = ContextLoader.getCurrentWebApplicationContext(); return context.getServletContext(); }
Tomcat启动后,从spring容器中获取Bean和ServletContext
标签:
原文地址:http://www.cnblogs.com/qq931399960/p/5177446.html