* @param webAppContext The current web application context.
* @return A handle which should be passed to {@link #leavingContext(WebApplicationContext, Object)}.
*/
public static Object enteringContext(WebApplicationContext webAppContext) {
// get request attributes
final RequestAttributes attributes = RequestContextHolder.currentRequestAttributes();
// save current class loader and web application context
final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
final WebApplicationContext oldContext = (WebApplicationContext) attributes.getAttribute(CONTAINER_REQUEST_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);
// set new class loader and context
attributes.setAttribute(CONTAINER_REQUEST_ATTRIBUTE, webAppContext, RequestAttributes.SCOPE_REQUEST);
Thread.currentThread().setContextClassLoader(webAppContext.getClassLoader());
return new ContextInfo(oldContext, oldClassLoader);
}