How to use Pooled Spring beans instead of Singleton ones?

前端 未结 5 1537
后悔当初
后悔当初 2021-01-14 16:45

For efficiency reasons, I am interested in limiting the number of threads that simultaneously uses the beans of the Spring application context (I don\'t want an unli

5条回答
  •  情书的邮戳
    2021-01-14 17:26

    You cannot use properties to get instances of prototypes.
    One option is to use the lookup methods (see chapter 3.3.7.1)
    Another option to get your bean in code: make your com.mycompany.ClientOfTheBusinessObject to implement the ApplicationContextAware interface and then call context.getBean("clientBean")

提交回复
热议问题