java - When unreferenced @Singelton beans are destroyed? -


I have a Java SE application with the CDI / Weld ( org.jboss.weld.environment.se StartMain started ).

I am doing the injection of @ Sissington in another bean:

  public class CDM {@ inject private mesiglittan mycelington; Start at Public Zero (@ Observe Container Initial Event) {mySingleton.printHello (); MySingleton = Faucet; // other long moving stuff}}  

I do not need a singleton bean after the printHello method. When will it be destroyed?

It is not clear if @ signleton beams destroyed at a specific point Will be done.
I do not trust him For example, during the Weld.shutdown () @PreDestroy method, it is not called on @Sypington .

Usage Bean, it's functionally similar (except that it is a proxy), which is also available in Java SE and when the reference to the application ends Then it will be 'destroyed'.


Comments