Order of class loading from a .war file

前端 未结 6 801
南方客
南方客 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:18

    The selected answer is wrong. Servlet spec version 2.4 and 3.0 clearly states that WEB-INF/classes are loaded first and then WEB-INF/lib

    Servlet 2.4: http://download.oracle.com/otn-pub/jcp/servlet-2.4-fr-spec-oth-JSpec/servlet-2_4-fr-spec.pdf - section SRV.9.5, last paragraph

    Servlet 3.0: http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr-oth-JSpec/servlet-3_0-final-spec.pdf - section 10.5, last paragraph

    The Web application class loader must load classes from the WEB-INF/classes directory first, and then from library JARs in the WEB-INF/lib directory.

提交回复
热议问题