How does one manage object pooling in Spring?
Asked Answered
N

1

17

It's my understanding that in Spring, all objects are treated by default as singletons. If singleton is set to false, then a new object will be served at each request.

But what if I wanted to pool objects? Say set a range from a min of 1 to a max of 10 instances? Is this possible using Spring?

Nedanedda answered 21/5, 2009 at 13:52 Comment(1)
I wouldn't see how it would be any different then using it in the Summer, Fall or Winter hiyoooo.comHandel
R
16

Pooling can be applied to any POJO with spring.

See here for more information.

Rennarennane answered 21/5, 2009 at 14:27 Comment(3)
+1 I think the real work here is being done by commons-pool, but this sounds like a good way to enable itGymnast
This is the sort of thing that makes Spring cool - take an off-the-shelf, best-of-breed open source library, and wrap it so that you can use it the same IoC way as everything else. Sweet.Inauspicious
FYI, link for the current.Nay

© 2022 - 2024 — McMap. All rights reserved.