关于类加载

类加载器种类

双亲委派模型

所谓双亲委派是指每次收到类加载请求时,先将请求委派给父类加载器完成(所有加载请求最终会委派到顶层的Bootstrap ClassLoader加载器中),如果父类加载器无法完成这个加载(该加载器的搜索范围中没有找到对应的类),子类尝试自己加载。

双亲委派好处

  • 避免同一个类被多次加载;
  • 每个加载器只能加载自己范围内的类;

类加载过程

 自定义类加载器

参考

http://www.cnblogs.com/aspirant/p/7200523.html

https://blog.csdn.net/G7N3F/article/details/50848479

https://blog.csdn.net/zhang625272514/article/details/35570065

https://baijiahao.baidu.com/s?id=1607840130268251381&wfr=spider&for=pc

原文地址:https://www.cnblogs.com/huilei/p/9418861.html