如何在 Spring 中管理对象池? [英] How does one manage object pooling in Spring?

查看:30
本文介绍了如何在 Spring 中管理对象池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,在 Spring 中,所有对象默认都被视为单例.如果 singleton 设置为 false,则每个请求都会提供一个新对象.

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.

但是如果我想合并对象怎么办?说设置一个范围从 1 到最多 10 个实例?这可以使用 Spring 吗?

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?

推荐答案

池化可以应用于任何带有 spring 的 POJO.

Pooling can be applied to any POJO with spring.

请参阅此处 了解更多信息.

See here for more information.

这篇关于如何在 Spring 中管理对象池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆