I'm wondering why Java introduced contexClassLoader for threads. I know that it is usualy used by frameworks and application servers which have to dynamically find and load classes.
However I don't understand why Java introduced contexClassLoader when we can achieve the same functionality simply by adding field that will hold necessary class loader.
class ThreadWithCustomClassloader extends Thread
{
ClassLoader threadClassLoader;
public void run()
{
//use threadClassLoader to dynamically find and load classes
}
}