-
Notifications
You must be signed in to change notification settings - Fork 25
[Autumn] Dependency injection after ContextInitializer has done its part. #69
Comments
Well it is possible, no doubts. I just needed to copy most of the code from |
That's what providers are for. Annotate a class with |
Thanks for pointing me out, after reading those examples, it seems like I'm still missing some base Autumn architectural concepts. So I see that Ok, so I should create |
No, I don't believe so. Now that I think about it, there should be a |
Yeah, it could be a good solution. Feels like it will require some extra logic for |
Should be very similar to converting current |
I have a case where I need to fill
VerticalGroup
with a complex items and I chose to go with individual controller instance per view item to encapsulate view logic and item model reference within. So this controller class has a lot of similarities withViewController
, like it has number of LML annotations and also should have injected dependencies to system-wide services/components.I remember the discussion #40 and it gave me a good point to keep
Context
not disposed in case I will need to obtain any system component in a future. And so I can, by callingContext#getComponent(Class<?>)
, but I start thinking if there is a way to automate this process. I mean in that fancy elegant way likeContextInitializer#initiateComponents()
does to resolve dependencies, but this time on demand for any specific instance with Autumn annotations like@Inject
(maybe even for@OnEvent
/@OnMessage
, but this could lead to memleaks due to an each instance should be unsubscribed manually).ContextInitializer
is fully dedicated to only initializeContext
and is not usable after. Feels like if there should be some injector service, then it better be outside ofContextInitializer
and available system wide so anyone can utilize dependency injection later.@czyzby what do you think, is it a good idea or even is it possible to add such utility functionality to the library core?
The text was updated successfully, but these errors were encountered: