Best approach to configure the dependency injection pattern with Java