I use an initializer to inject the currently logged in user into all controllers (jsfiddle)
Now, initializers have been split up into initializers and instance-initializers.
So I’m trying to move my initializer to an instance-intiailizer. But questions come to mind:
-
registry
is mentioned in the above link, but nowhere else.- What is it?
- How does it differ from
container
?
-
instance
is a parameter for an instanceInitializer. But an instance of what? It doesn’t seem to be an instance of the application which is what I would have expected. -
I used to use
application.inject
as per the documentation. However, when used inside an instance-initiailizer I getapplication.inject is not a function
- Does this mean we should use
container.injection
instead? - If so, isn’t that meant to be private?
- Does this mean we should use
-
As I understand it (and I may be wrong) Everything must have been registered and injected before the instanceInitializers get executed. But this removes the ability to look something up, and then register and inject based upon that lookup. (Which means the pattern in the above jsfiddle is no longer possible)
Could anybody in-the-know please clarify.