So basically if a client request calls a business method on the @ApplicationScoped bean and this method calls get () on the injected provider i would keep creating (and storing) dependent scoped beans until the @ApplicationScoped bean will be destroyed (which it will not until the application is shutdown/restarted).
Correct? Is there a way around this? I could change the scope of the bean I guess but then loose the possibility to use InjectionPoint... i could use new and create the bean but then it couldnt include any injected resources itself.... suggestions? On Feb 27, 2015 7:06 PM, "Romain Manni-Bucau" <[email protected]> wrote: > If dependent it will be kept in enclosing bean. > Le 27 févr. 2015 19:00, "Lars-Fredrik Smedberg" <[email protected]> a > écrit : > >> So does this mean that there will be a memory leak in the case Karl >> described? >> >> I have used similar constructs before so im curios (@Inject @Provider >> <some dep scoped bean> in an @ApplicationScoped bean and called get () on >> the injected provider). >> >> I thought for a while that it might get garbage collected when the >> created bean is outof scope or maybe then there is no way for @PreDestroy >> to be called? >> >> Regards >> LF >> >> I thought that the created dep scoped bean would be >> On Feb 27, 2015 6:07 PM, "Romain Manni-Bucau" <[email protected]> >> wrote: >> >>> Yes. >>> >>> Will be destoyed with the bean where it is injected IIRC so the app here. >>> Le 27 févr. 2015 16:59, <[email protected]> a écrit : >>> >>>> Hello! I have a bean with @ApplicationScoped. When I inject >>>> Instance<MyInterface> instance and my actual beans implementing MyInstance >>>> are dependentscoped they get recreated over and over and are not gc'd. >>>> >>>> Expected behavior? >>>> >>>> Cheers >>> >>>
