Yes, Spring uses singleton by default for beans. But for Repo and DB classes
Spring has its own way of handling that. As I mentioned using a Singleton in
a bean that deals with the DB is a big scalability issue. All DB calls will
be going through a single EM/DB connection. With stateless that's not the
case.

Another mistake I see people make is where they use singletone with @Async
and forget about thread safety of EM and other resources. This issue does
not apply to stateless bean as each invocation has its own instance.

I would use Singletons where no DB or external services are called
(concurrent requests). Otherwise, I would use stateless.



--
View this message in context: 
http://openejb.979440.n4.nabble.com/ConcurrentAccessTimeoutException-tp4661288p4661508.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to