On Fri, Jan 14, 2011 at 10:13 AM, Adam Warski
<adam@warski.org> wrote:
Hello,
have you considered adding a stateless scope to Weld?
I've definitely felt the paint of not having this, for all the reasons stated.
-Clint
Here's my use-case:
I have some beans which are inherently stateless, e.g. "services" or factory methods. The only fields they have are injected. I am using these beans in normal-scoped passivation-capable beans, e.g. session or conversation scoped. In such case, they also have to be passivation-capable, which means either
(a) be normal-scoped (proxyable)
(b) implement Serializable and leave the bean dependent-scoped
If I go with (a) this means that I'd have to put my bean in the request, session, conversation or application scope. However none of these choices make much sense, as they indicate the my beans holds request/session/etc-scoped data - which it doesn't, as it is stateless.
So I am left with (b) - implement Serializable + dependent scope. But is that the right thing to do always? Firstly, if I have a lot of such stateless beans, which are injected one into another, serializing a simple session-scope bean may mean that half the beans in my application get serialized. Secondly, a developer looking at such a bean could wonder why is this bean serializable? Esp if it doesn't have any state?
Hence what I'd like in fact is a proxyable scope (normal), which on serialization would only write the proxy informat