DI with cyclic dependency with custom HTTP and ConfigService
<p>I'm trying to implement a ConfigService to retrieve the right configuration for the right environment in the project. I'm currently encountering a cyclic dependancy</p>

<pre><code>(index):28 Error: (SystemJS) Provider parse errors:
    Cannot instantiate cyclic dependency! Http: in NgModule AppModule
    Error: Provider parse errors:
</code></pre>

<p>I've explored the code and there is the problem, in my opinion:</p>

<p>CustomHttp</p>

<pre><code>constructor(backend: XHRBackend, options: RequestOptions, public spinnerService: SpinnerService, public exceptionService: ExceptionService, public configService: ConfigService) 
</code></pre>

<p>ExceptionService</p>

<pre><code>constructor(private _notificationService: NotificationService, private _spinnerService: SpinnerService, private _configService: ConfigService, private _router: Router)
</code></pre>

<p>ConfigService</p>

<pre><code>constructor(private http: Http) {}
</code></pre>

<p>As you can see, I've a cyclic dependancies illustrated in this diagram (without any good convention):</p>

<p><a href="https://i.stack.imgur.com/MkLp8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MkLp8.png" alt="enter image description here"></a></p>

<p>My question now is, how to fix it? I've heard of <code>Injector</code> but I'm not sure I can really use it in this context.</p>

<p>Thanks in advance for your answer.</p>