[SPRNET-1450] Web object scopes not working in MvcApplicationContext Created: 09/Jun/11  Updated: 05/Jul/11  Resolved: 05/Jul/11

Status: Resolved
Project: Spring.NET
Component/s: Spring-NET-WEB, Spring-NET-WEBMVC
Affects Version/s: 1.3.1
Fix Version/s: 1.3.2

Type: Bug Priority: Major
Reporter: Jan Kockrow Assignee: Steve Bohlen
Resolution: Fixed Votes: 0
Labels: mvc, scope
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Web object scopes are working in WebApplicationContext, but they are not working in MvcApplicationContext as stated in the documentation. The reason is, that the support for web object scopes is given by spring.web.dll. Since the spring.web.mvc.dll is not depending on spring.web.dll, it is impossible to instantiate an MvcApplicationContext that can resolve session scoped objects. MvcApplicationContext actually behaves like a standard application context, which is using the class RootObjectDefinition whis doesn't know about the scope attribute. The WebApplicationContext instead instantiates RootWebObjectDefinition types, which know the scope.

We made a workaround to this issue and posted it on StackOverflow: http://stackoverflow.com/questions/6060386/spring-net-and-mvc3-on-iis7-session-scope-behaviour

Comment by Steve Bohlen [ 09/Jun/11 ]

This is a known issue – the docs are out of sync with the implementation (as you have noted). Support for MVC3 that is being released as part of 1.3.2 very shortly (SPRNET-1443) corrects this oversight for MVC3 but this issue will need to be addressed in our MVC2 support as well (as you point out). Thanks for catching this as well as suggesting a fix for it.

Comment by Steve Bohlen [ 05/Jul/11 ]

mod inheritance hierarchy for MvcApplicationContext to inherit from WebApplicationContext as was originally intended (and documented!)

Generated at Wed Oct 23 07:33:10 UTC 2019 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.