-
1. Re: Injecting Session-scoped object in Application-scoped component
sherkan777 May 14, 2009 2:37 PM (in response to vralev.vladimir.ralev.gmail.com)Maybe this help
Contexts.getApplicationContext().set("name", obj); Contexts.getSessionContext() Contexts.getEventContext()
-
2. Re: Injecting Session-scoped object in Application-scoped component
cpopetz May 14, 2009 3:06 PM (in response to vralev.vladimir.ralev.gmail.com)What are you are trying to do is supported, so you'll have to show more code to find out why it's not working for you. I'm not sure what you mean by
After that it's flagged as injected and ignored by the BijectionInterceptor.
Injection/Disinjection happensa at entry/exit from a method. So if you are calling back to an application scoped object that is already on your call stack, then yes, you won't get a new instance, because it's already injected. But that makes no sense for the case in question, because you'd never have to session scopes in the same thread. -
3. Re: Injecting Session-scoped object in Application-scoped component
swd847 May 15, 2009 2:30 AM (in response to vralev.vladimir.ralev.gmail.com)Application components are not synchronized, so this approach is just asking for trouble. You can stick an @Synchronized annotation on it but if you have lots of clients accessing it your performance is going to go down the toilet.
Just use Component.getInstance() instead.