You realize Java has the feature you're discussing, without dependency injection?
class Foo {
static {
initialize();
}
}
They even have a well defined execution order:https://docs.oracle.com/javase/specs/jls/se8/html/jls-14.htm..., section 8.7, with order defined in section 12.4