why do we need user defined classloader in java

后端 未结 3 894
感动是毒
感动是毒 2021-01-05 08:45

why tomcat has its own classloader. what is the advantage of having user defined classloader

3条回答
  •  伪装坚强ぢ
    2021-01-05 09:50

    Tomcat (and other application containers) need to be able to handle loading classes from WAR files etc. How would you be able to do that without using user-defined classloaders?

    EDIT: Basically you need user-defined classloaders if you need to load classes or resources in "unusual" ways... such as from an EAR or WAR file. As another example, you might load classes from a database, or from some secure storage.

提交回复
热议问题