Instantiating only required services? #17
Description
Hello,
I am currently trying to create the lightest ZF2 CLI app to get the most performance out of it. When trying to use zend-mvc as my only dependency, I ran into the fact that I was missing MANY dependencies for a simple Application::init.
I dug a bit deeper and realized that the module manager https://github.com/zendframework/zend-mvc/blob/master/src/Service/ModuleManagerFactory.php is instantiating EVERY service whether or not it has been defined in the config or not.
I'm using a CLI app, I don't necessarily need form_elements to be instantiated, the same goes for hydrators, serializers, etc...
I'd like some feedback on this, could we make those optional if they aren't set in the config ? I don't reckon we need to have the services created if they are not used/needed. Maybe I don't have the whole picture here, could someone enlighten me ?
Once I have more info on this I can submit a pull request.
Thanks a lot !