The Spring documentation provides the following example to show us the reason why we need to explicitly define aop: scoped-proxy in beans of a visibility session, requests, etc.
<bean id="userPreferences" class="com.foo.UserPreferences" scope="session">
<aop:scoped-proxy/>
</bean>
<bean id="userManager" class="com.foo.UserManager">
<property name="userPreferences" ref="userPreferences"/>
</bean>
A proxy server is needed here, because for every userPreferencesbean request we want to delegate it to a bean instance with a cloud session. It is clear. But the documentation also said that this is deafness behavior for singletone/prototypethe beans area.
Consider the following example:
<bean id="userPreferences" class="com.foo.UserPreferences" />
<bean id="userManager" class="com.foo.UserManager">
<property name="userPreferences" ref="userPreferences"/>
</bean>
Why do we need a proxy server in case of singletone-scoped beans? Are injections and calls introducing some performance overhead into the proxy server?
. , bean singletone -scoped beans?