- /**
- * Obtain the Spring root web application context for the current thread
- * (i.e. for the current thread's context ClassLoader, which needs to be
- * the web application's ClassLoader).
- * @return the current root web application context, or <code>null</code>
- * if none found
- * @see org.springframework.web.context.support.SpringBeanAutowiringSupport
- */
- public static WebApplicationContext getCurrentWebApplicationContext() {
- return (WebApplicationContext) currentContextPerThread.get(Thread.currentThread().getContextClassLoader());
- }
- //该片段来自于http://www.codesnippet.cn/detail/070620133892.html
来源: http://www.codesnippet.cn/detail/070620133892.html