-
1. Re: HOWTO create more then one instance of a contextual bean
mkouba Aug 6, 2012 3:42 AM (in response to suikast42)This is the limitation of any normal scope (e.g. @RequestScoped, @SessionScoped, @ApplicationScoped, ...). There may be no more than one mapped instance per bean per thread. So if you inject controller1_1 in fact you inject a proxy that points to the same instance like controller1_2 does. However you can use dependent pseudo-scope. In that case no proxy is injected and also no injected instance is shared between multiple injection points (see also CDI spec 6.4. Dependent pseudo-scope).
-
2. Re: HOWTO create more then one instance of a contextual bean
suikast42 Aug 6, 2012 4:34 PM (in response to mkouba)Hi Martin,
unfortunally the dependent scope is not in my focus. Beacuase in my usecase I must communicate with more then one instance of the same bean or interface. So I had the idea to migrate my EJB stateful beans to CDI Sessionscoped bean for communicate over cdi events. But the dependent scope create for every event a new instance.
I understood the cdi way to create instances wrong. I'm little bir smarter know . I think .
If I don't understand it wrong then this is in focus of CDI 1.1 . Right ??
-
3. Re: HOWTO create more then one instance of a contextual bean
mkouba Aug 7, 2012 3:45 AM (in response to suikast42)Hi Sueleyman,
yes, I guess CDI-103 is the feature request you should be watching
-
4. Re: HOWTO create more then one instance of a contextual bean
suikast42 Aug 7, 2012 4:33 AM (in response to mkouba)Martin Kouba schrieb:
Hi Sueleyman,
yes, I guess CDI-103 is the feature request you should be watching
So then let's wait