1. A computer implemented method for automatic discovery of a classloader delegation hierarchy, the computer implemented method comprising: instrumenting one or more classloaders with byte code instrumentation code such that a delegation event is received each time the one or more classloaders delegate a resource finding method to a parent classloader of the one or more classloaders; determining, from each delegation event received, a classloader that generated the delegation event and a parent classloader to which the classloader directly delegates the resource finding method; determining, based on the delegation events received, the classloaders to which a current classloader in the one or more classloaders can directly delegate; and determining an order of delegation to the classloaders.