Hi,

As you might don't know, as I didn't, constructors of CDI managed beans are
not guaranteed to be invoked just once per instance. In fact, with our
current Weld implementation, at least for @ApplicationScoped ones,
constructors are invoked once per injection point. The specs guarantee,
though, that if there is a method with @PostConstruct annotation, it will
be invoked just once per instance.

OK, so...?

In practice, this means you should use a @PostConstruct method to do
initialization in your beans, specially if they assume a single instance or
are expensive (well, even better if you don't do expensive initializations).


http://docs.oracle.com/javaee/6/tutorial/doc/gmgkd.html
http://stackoverflow.com/questions/18378608/why-is-constructor-of-applicationscoped-class-called-more-than-once
http://stackoverflow.com/questions/3406555/why-use-postconstruct
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Openbravo-development mailing list
Openbravo-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-development

Reply via email to