I'm reviewing code with a lot of statements like this:
private SomeInterface x = Locator.getInstance(SomeInterface.class)
I would expect something like
private SomeInterface x;
@Inject
public Consumer(SomeInterface x){ // constructor
this.x = x;
}
Is there something wrong with the first approach? Ok, dependencies are not so obvious, but implementations could easily be swapped through configuration of Locator.