How many instances created for singleton bean referring to a session bean/prototype bean

后端 未结 2 977
醉话见心
醉话见心 2021-01-29 23:33

I have a doubt about the number of instances that will be created in the scenario mentioned below, when Spring Framework is used:

The bean configuration is like

2条回答
  •  粉色の甜心
    2021-01-30 00:21

    If we use the way as mentioned in question spring IOC will create always return the same object as singleton, In order to inject prototype bean inside singleton we have two way

    1) Lookup method injection

    2) Scoped Proxies

    see more detail here

提交回复
热议问题