Hi Depend the scope but generally first invocation triggers everything if owb added a proxy Le 2 déc. 2013 19:42, "Lars-Fredrik Smedberg" <[email protected]> a écrit :
> Hi! > > How "lazy" is OWB? I might have done something wrong in my tests but I > think I've seen the following: > > - For both tests I created the bean using a @Produces method in a factory > class (I tried creating the bean with @RequestScoped and @SessionScoped > scopes) > - For both tests the bean had a @PostConstruct annotated method and a > simple "business method". > > Test 1) > > - The bean being created did inject other CDI managed beans using @Inject > => In this case I could see that the @Produces method was called when the > bean being created was injected into my test resource BUT the > @PostConstruct was not called until i called the business method from the > test resource. > > Test 2) > > - The bean being created did NOT inject other CDI managed beans using > @Inject > => In this case the @PostConstruct method was called right after the > @Produces method, that is without I have to call the business method first. > > Questions: > > 1) Did I do something wrong when I did test the two cases above? > 2) Can anyone explain the some of the different optimizations OWB does or > where I can read about them? > > Regards > Lars-Fredrik > > -- > Med vänlig hälsning / Best regards > > Lars-Fredrik Smedberg > > STATEMENT OF CONFIDENTIALITY: > The information contained in this electronic message and any > attachments to this message are intended for the exclusive use of the > address(es) and may contain confidential or privileged information. If > you are not the intended recipient, please notify Lars-Fredrik Smedberg > immediately at [email protected], and destroy all copies of this > message and any attachments. >
