Does the Spring container running on the application server have a separate class loader?

Is there a separate class loader in the Spring container running on the application server? If it has a separate class loader, what is its parent class loader?

+3
source share
3 answers

No, Spring does not have a separate classloader. If you are in webapp (war), it has a separate classloader. If this war is contained inside the ear, it will be the parent, otherwise there will be some cool application class loader, etc. It really depends on the application server. For instance. in the case of Tomcat 5.5, the hierarchy usually has 4 classes of loaders: war → shared (common to all wars) → common → bootstrap In Tomcat 6, the general and common were combined into the same one.

, Spring, ThreadClassLoader Thread # undefined. Spring webapp Thread # contextClassLoader. Spring ThreadClassLoader . , ( ) ThreadClassLoader Thread #, .

0

. Spring ( ) .

Thread.getContextClassLoader() classloader, Webapp/ejb, .

+1

Spring web.xml, , . , , .

0

Source: https://habr.com/ru/post/1782585/


All Articles