Order of class loading from a .war file

前端 未结 6 802
南方客
南方客 2020-12-09 10:45

I\'ve got a question regarding the guarantees, if any, in the following scenario (note that the question is not \"How to do this in a different way?\", the question

6条回答
  •  生来不讨喜
    2020-12-09 11:26

    It depends on the container that deploys the war file. From my experiences, WEB-INF/classes location is always before lib/ on the classpath of a classloader for application context.

    Classes are loaded right after the deployer expands the war into the container. Usually when a context loader listener servlet is loaded and the rest of the application with it. It can be done in many ways such as by a reference to default servlet or loading spring context etc.

    So that WEB-INF/classes/com/acme/Bunny.class should be loaded first afaik.

提交回复
热议问题