Sorry to waste everyone's time. I of course missed a critical step from
the Spring 2.0 documentation. In order to enable the special scopes
(everything other than prototype/singleton) A listener or a filter
(depending on your serlevt spec) needs to be added to your web.xml
2.4
<listener>
<listener-class>org.springframework.web.context.request.RequestContextLi
stener</listener-class>
</listener>
Or
2.3
<filter>
<filter-name>requestContextFilter</filter-name>
<filter-class>org.springframework.web.filter.RequestContextFilter</filte
r-class>
</filter>
<filter-mapping>
<filter-name>requestContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Once I added the listener, my beans were placed into session scope as
requested.
JB
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig
McClanahan
Sent: Tuesday, August 22, 2006 1:37 PM
To: [email protected]
Subject: Re: Shale and Spring 2.0
On 8/22/06, Baker,Jonathan <[EMAIL PROTECTED]> wrote:
>
> In an earlier discussion about mixing Spring and Faces beans Craig
> described moving to Spring 2.0 to make use of Spring's ability to put
> beans into a specified scope (See below). I made the move to Spring
> 2.0
> RC3 just to see what that could get me. Unfortunatly, even when I
> told Spring to stick beans into session scope, they were not showing
> up. I went to the Shale documentation to make sure I had set things
> up with the shale-spring jar correctly and found this comment:
>
> "Note, however, that the Spring integration capabilities do not
> include the ability to place a Spring-created bean into a specified
scope.
> Therefore, it works best for application singletons, or for beans
> where you wish to create a new instance on every request."
>
> Was this just a reference to Spring 1.2.XXXs inability to put beans
> into a specified scope, or is there a limitation with the shale-spring
> jar to allow Spring beans to be placed into
application/session/request scope?
> If it is a limitation with the shale-spring jar, are there any plans
> to add this capability since Spring now supports it?
It was indeed a reference to 1.2's inability in this respect.
I would expect using Spring2 to "just work" ... even without adding
shale-spring.jar to the picture ... as long as you have properly
configured Spring itself. It's on my list to try, but that list is
pretty long :-).
JB
Craig
Glad you got the initial issue sorted out. With regards to Spring AOP
> and view controllers, that's a pretty interesting idea. However, if
> you are using Spring 1.2.x you are up against a limitation ...
> Spring's bean factory doesn't know anything about scopes. It can only
> create application singletons, or a new instance on every request. It
> doesn't know how to put things into a scope for you (although I
> thought I had seen a SourceForge project called "spring-jsf" or
> something that tried to bridge this gap).
>
> For Spring 2 (currently working towards its first GA release), the
> story is substantially better ... you can declare, in your
> applicationContext.xml (or
> whatever) configuration files, what scope to put the newly created
> beans into, so you can do everything that standard JSF managed beans
> do for you (plus the extra stuff that Spring provides, obviously). I
> don't know what the story is for annotation-based configuration,
however.
>
> ...
>
> Craig
>