Wanted to give a quick update to this issue.  

I'm still at a loss as to what I should do to fix this issue I'm having with
scoped Spring beans being injected into my mock unit tests.  I've tried just
about everything I know and nothing seems to be working.  

Does anyone have any thoughts or ideas on what I can do to get around this
issue?

Thanks!


paulsjv wrote:
> 
> I created a mockSession and instantiated it in my setup method.  In my
> test I pass it when creating a new MockRoundTrip and I get the stack trace
> below.
> 
> You are right there are a couple of Spring beans that are being created at
> start up that are scoped to "session."  Like I said previously we were
> able to work around this issue in our main application by adding the
> RequestContextListener in the web.xml file to give Stripes access to
> session scoped beans for injection into our Stripes app.
> 
> Long story short as to the reasons why we are using session scoped Spring
> beans is for our login bean.  Basically, when this Spring app was written,
> about 3 years ago, they had to keep a session of the login bean so that it
> can be passed to a service that would check credentials before accessing
> any data in our service layer.  This service layer is a Spring bean that
> is injected with the login bean so it (the service layer Spring bean) is
> session scoped as well.  However, this service layer Spring bean is also a
> proxied bean.
> 
> The challenge for us is that our Stripes application has to use the
> session scoped login Spring bean.  But since it is being injected upon
> startup for our unit tests we are not sure how to either do a work around,
> which might include creating a applicationContext-test.xml where there are
> no session scoped Spring beans.  This is not desirable because we would
> have to maintain two aplicationContext*.xml files. 
> 
> We are not sure what other options we have if we can't get the session
> scoped login bean to work with our current unit testing framework.
> 
> Thanks for any help!
> 
> Jay
> 

-- 
View this message in context: 
http://old.nabble.com/Unit-Testing-Mock-Object---Spring-Beans-tp26845824p26889434.html
Sent from the stripes-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to