spring如何管理原型(prototype)bean的生命周期?如果不是调用原型(prototype)bean的destroy方法?
最佳答案
原型(prototype) bean 在后台使用原型(prototype)模式:
Prototype pattern allows us to hide the complexity of making new instances from the client. The concept is to copy an existing object rather than creating a new instance from scratch, something that may include costly operations. The existing object acts as a prototype and contains the state of the object. The newly copied object may change same properties only if required. This approach saves costly resources and time, especially when the object creation is a heavy process.
除了应用程序管理的上下文对象使用 AOP 之外,它们还包装在代理对象中。在原型(prototype)作用域 bean 的情况下,底层方面将 bean 的创建委托(delegate)给此模式的基于 spring 的实现。
关于java - spring 如何管理原型(prototype) bean 的完整生命周期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56806600/