在 spring.net 中预实例化原型
上下文:我有一组 View/Presenters,并且我注意到,对于复杂的视图,我在 InitializeComponent()
调用时遇到一些性能问题
有没有什么方法可以指示 spring 容器预实例化范围为原型的对象?类似于在应用程序请求对象时准备好对象的队列?
Context: I have a set of View/Presenters and I've noticed that for complex views I get some performance issues at the time of the InitializeComponent()
call
Is there any way to instruct the spring container to pre-instantiate objects scoped as prototype
? Something similar to a queue with the objects ready when the application requests them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们遇到了完全相同的问题。我们还发现这种性能开销仅在我们第一次从容器请求表单时发生。我们没有找到一个干净的解决方案,因此我们决定编写一个在后台运行的初始化例程,并从容器中请求所有 Form 类型的对象。当这个例程完成后,所有表格都会快速打开。
期待更好的解决方案,但这对我们有用。此解决方法的主要缺点是,在初始化例程期间,用户可能仍然会遇到一些缓慢加载表单的情况。
We had exactly the same problem. We also found that this performance overhead occured only the first time we requested a form from the container. We didn't find a clean solution, so we decided to write an initialization routine that runs in the background and requests all objects of type Form from the container. When this routine is finished, all forms open quickly.
Looking forward to a better sution, but this worked for us. Main disadvantage of this workaround is, that during the initialization routine, users might still experience some slow loading forms.