In my Java web app, I have these files:
/WEB-INF/classes/com/example/Foo.class
/WEB-INF/lib/example.jar <-- contains the class "com.example.Foo"
Will the class defined in the classes directory be used instead of the class defined in example.jar?
Thanks.
The answer depends upon your container, it is container dependent. In general, /WEB-INF/classes is preferred to classes in a jar file in WEB-INF/lib.
For Tomcat, the order is the following:
Therefore, from the perspective of a web application, class or resource loading looks in the following repositories, in this order:
But if you're using a different container, you need to consult the documentation for that server.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With