-
1. Re: lazy singleton support
csa Dec 4, 2013 5:56 PM (in response to marius.gerwinn)1 of 1 people found this helpfulHi Marius,
Yes, I think having this as a feature would be nice. I'd prefer having an extra annotation @LazySingleton as you suggested. However, simply skipping the addBean() call won't do it because this call just registers the bean with the BeanManager. We would have to find a way to delay the call to getInstance() in the Bootstrapper until the bean is actually used. Until it is either injected into a non-lazily loaded bean (in that case @LazySingleton would behave exactly like @Singleton), or into another lazily loaded bean that was just created or until it is being looked up using the BeanManager API.
Of course, you're more than welcome to take a stab at it / create a JIRA if you're interested!
Cheers,
Christian
-
2. Re: lazy singleton support
marius.gerwinn Dec 4, 2013 6:05 PM (in response to csa)Hallo Christian,
thanks for your answer and the hints regarding an implementation.
We already have already started implementing lazy singletons in our app using the @LazySingleton Annotation.
The next weeks we will finish and test this implementation in our app. But its looking good so far. When we think its finished we can make a pull request.
We will do so eventually when we face to much merge conflicts with the main errai branch
Marius
-
3. Re: lazy singleton support
jimmy.pannier Mar 9, 2016 9:03 AM (in response to marius.gerwinn)What about such singleton with lazy loading in errai v3.1.2 ?
-
4. Re: lazy singleton support
ben.dol Nov 24, 2016 12:15 AM (in response to jimmy.pannier)Anyone know if this was progressed?
-
5. Re: lazy singleton support
mbarkley Nov 24, 2016 11:00 AM (in response to ben.dol)In Errai 4, @Singleton and @ApplicationScoped beans are no longer instantiated before they are injected somewhere. Furthermore, @ApplicationScoped beans behave as in Weld: they are proxied by the container and are not actually instantiated until a method is invoked.