Improve performance on JVM 7

Detects presence of `getClassLoadingLock` method and uses it when
available. In case of JVM 6 uses plain old synchronization on `this`.

This patch uses assumption that spring-boot compiles on JDK >= 7.