public static ClassLoader overrideThreadContextClassLoader(ClassLoader classLoaderToUse){
  Thread currentThread=Thread.currentThread();
  ClassLoader threadContextClassLoader=currentThread.getContextClassLoader();
  if (classLoaderToUse != null && !classLoaderToUse.equals(threadContextClassLoader)) {
    currentThread.setContextClassLoader(classLoaderToUse);
    return threadContextClassLoader;
  }
 else {
    return null;
  }
}

public static ClassLoader overrideThreadContextClassLoader ( ClassLoader classLoaderToUse ) { Thread currentThread = Thread . currentThread ( ) ; ClassLoader threadContextClassLoader = currentThread . getContextClassLoader ( ) ; if ( classLoaderToUse != null && ! classLoaderToUse . equals ( threadContextClassLoader ) ) { currentThread . setContextClassLoader ( classLoaderToUse ) ; return threadContextClassLoader ; } else { return null ; } }
override the thread context classloader with the environment ' s bean classloader if necessary , i . e . if the bean classloader is not equivalent to the thread context classloader already .
