It depends upon the Java container, I believe. We use WildFly and it deploys them in the order listed in the standalone.xml (or domain.xml) file. This list can be found at the bottom of these files. For other containers like Tomcat, it may be related to their alphabetical order in the deployment directory itself, which may also be true for WildFly if you’re using such a deployment method.
I believe it’s possible to control the load order within many Java containers, though I’ve never tried it. For WildFly, this seemed like it was complicated.