Spring Bean Scopes

前端 未结 9 1760
说谎
说谎 2020-11-29 18:25

Can someone explain what the scopes are in Spring beans I\'ve always just used \'prototype\' but are there other parameters I can put in place of that?

Example of wh

9条回答
  •  渐次进展
    2020-11-29 18:53

    About prototype bean(s) :

    The client code must clean up prototype-scoped objects and release expensive resources that the prototype bean(s) are holding. To get the Spring container to release resources held by prototype-scoped beans, try using a custom bean post-processor, which holds a reference to beans that need to be cleaned up.

    ref : https://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch04s04.html#beans-factory-scopes-prototype

提交回复
热议问题