|
From: Dmitry S. <ds...@ch...> - 2006-08-03 16:25:19
|
Check out spring doc, specifically. 3.4.3.5. Scoped beans as dependencies >From what I understand: You will only need to use <aop:scoped-proxy/> if you need to inject the scoped bean into some other bean. Spring treats scoped beans like a subtype of "prototype" so without a proxy it has no knowledge of scoped beans after they are created and "scoped" Dmitry Quoting And...@ub...: > Hi, > > I've been looking over the new scoped bean functionality, and it looks > really good. However, I'm a bit puzzled about the need to have the > <aop:scoped-proxy/> as part of the definition. I understand why I proxy > is needed, I'm just not sure why a user has to specify one. Simply put, > if the scope is "session" or "request" (or custom for that matter), > should these beans not automatically be using a scoped proxy without > having to explicitly say so? > >From the Spring docs it shows we need to do this: > <bean id="userPreferences" class="com.foo.UserPreferences" > scope="session"> > <aop:scoped-proxy/> > </bean> > > Put another way, is there any case when you would not want to proxy > these beans? Or, in general use, if most people do use a proxy, but > there is a rare chance that someone wants to use a non-proxied bean, > then can a parameter be set up accordingly? > eg: > <bean id="userPreferences" class="com.foo.UserPreferences" > scope="session"> > <aop:no-proxy/> > </bean> > Or > <bean id="userPreferences" class="com.foo.UserPreferences" > scope="session" proxied="false" /> > > Regards, > > Gus. > > Thanks Dmitry |