This is not the correct mailing list for these questions, this list is
for discussing the development of weld. User questions should be asked
on the weld forums.
What actually gets injected into your servlet is a proxy, and the proxy
is thread safe. When a thread calls a method on the proxy Weld looks up
the appropriate request scoped instance, and then delegates the
invocation to that instance. If two threads are invoking on the same
proxy it does not matter, as the underlying instances that the proxy
delegates to will be different.
Daniel Pub wrote:
I've been developing some code with CDI.
I was wondering what happens when I mark a servlet property with @Inject
and define the bean with @RequestScoped but the bean class itself is not
thread safe but it's a property of my servlet so looking by the servlet
perspective it could be accessed by multiple threads.
Do we have something that makes these properties accessible to just one
request / thread even tough they are servlet's class properties?
weld-dev mailing list