title: Using own Application class in ZF2
body: <p>I have been playing with my own <code>MyApplication</code> class (extending <code>Zend\Mvc\Application</code>) in ZF2. </p>
  
  <p>In <code>index.php</code> I use </p>
  
  <pre><code>MyApplication::init(
     // here goes system config...
  )-&gt;run();
  </code></pre>
  
  <p>One essential problem with this is that ServiceManager will still set <code>Zend\Mvc\Application</code> as the 'Application' service. </p>
  
  <p>I noticed that in <code>Zend\Mvc\Service\ServiceListenerFactory</code> where the default <code>Application</code> factory is defined, there is a note that this default MVC-related service configuration can be overridden by modules. I was playing with it but was not able to make my <code>MyApplication</code> instance as the <code>'Application'</code> service. </p>
  
  <p>I am using ZF2 version 2.2.6. Any hints would be appreciated.</p>