Announcement Announcement Module
Collapse
No announcement yet.
Usage of Spring.context.Support.WebApplicationcontext in Application confgi file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Usage of Spring.context.Support.WebApplicationcontext in Application confgi file

    I am trying to use WebApplicationContext to initialize the Spring.Net root context in a nunit test project.
    Code snippet in nunit app.config file

    <sectionGroup name="spring">
    <section name="context" type="Spring.Context.Support.WebContextHandler, Spring.Web"/>
    <section name="objects" type="Spring.Context.Support.DefaultSectionHandler , Spring.Core"/>
    </sectionGroup>
    </configSections>
    <system.web>
    <httpHandlers>
    <add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
    </httpHandlers>
    <httpModules>
    <add name="Spring" type="Spring.Context.Support.WebSupportModule, Spring.Web"/>
    </httpModules>
    </system.web>
    <spring>
    <context type="Spring.Context.Support.WebApplicationContext , Spring.Web">
    <resource uri="config://spring/objects" />
    </context>
    ...
    </spring>

    the code that initialize the spring context is
    WebApplicationContext context = ContextRegistry.GetContext() as WebApplicationContext;

    I am getting an exception
    CI.DataManagerUI.NUnits.Controller.ChangePasswordC ontrollerTest.TestMethod_UpdatePassword_return_exp ected_view threw exception: System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration section handler for spring/context: Object reference not set to an instance of an object. (D:\Multisite\imb\ServiceApps\DataManager\branches \IMD2.4.0-branch\apps\Mail360WebUI\src\Mail360DMClientApp\Te stResults\ru001pu_RUPUNDIR-W1 2012-10-05 17_26_40\Out\CI.DataManagerUI.NUnits.Controller.dl l.config line 37) ---> System.NullReferenceException: Object reference not set to an instance of an object..

    Is it that WebApplicationContext can be used in Web.config and not in app.config files???
    For App.config can we use only Applicationcontext as this error goes away if I use IApplicationContext???

    Thanks
Working...
X