jimbobdog
08-01-2006, 04:39 PM
I'm new to Spring and ASP.NET 2.0 (just to make things difficult)
The question I have is how do I configure an ASP.NET 2.0 web application that references an assembly that uses Spring? There is no requirement to dependency inject or leverage anything from Spring in the web pages/project (yet) - all I want is the underlying assembly to get access to the main context and objects configuration I have.
I have this working perfectly in a console application and the assembly picks up the context & objects configuration no problem. We are now using this assembly (a data access wrapper) in a web project and configured the web.config with the section group and spring section from the app.config we have.
It all looks great except it cannot load the objects configuration file for a child context (using resource uri="file://Config/data.providers.config"). The relative path defined in the resource uri seems to get appended to the current folder which is SYSTEM32\INETSRV...(obviously where the web application process is being executed from - I understand this).
Having looked at this forum there is a reference to Spring.Web and I notice a new style context type of "Spring.Context.Support.WebApplicationContext" - I assume that this is a web application aware context loader implementation and uses Server.MapPath and other logic to load a relatively pathed configuration file correctly into a web application - is this correct?
Now, do I find the Spring.Web stuff in Spring.Net 1.1 Preview 2 and is the minimum change I need to do to enable the configuration file to be loaded correctly is change the context type to "Spring.Context.Support.WebApplicationContext" and set the resource uri to "~/config/data.providers.config"?
All I need is to get the objects configuration accessible to the referenced sub assembly in a web application. I don't need to acces any Spring stuff directly in the web project itself. What do I need to do?
Thanks for any help you guys can provide!
James
The question I have is how do I configure an ASP.NET 2.0 web application that references an assembly that uses Spring? There is no requirement to dependency inject or leverage anything from Spring in the web pages/project (yet) - all I want is the underlying assembly to get access to the main context and objects configuration I have.
I have this working perfectly in a console application and the assembly picks up the context & objects configuration no problem. We are now using this assembly (a data access wrapper) in a web project and configured the web.config with the section group and spring section from the app.config we have.
It all looks great except it cannot load the objects configuration file for a child context (using resource uri="file://Config/data.providers.config"). The relative path defined in the resource uri seems to get appended to the current folder which is SYSTEM32\INETSRV...(obviously where the web application process is being executed from - I understand this).
Having looked at this forum there is a reference to Spring.Web and I notice a new style context type of "Spring.Context.Support.WebApplicationContext" - I assume that this is a web application aware context loader implementation and uses Server.MapPath and other logic to load a relatively pathed configuration file correctly into a web application - is this correct?
Now, do I find the Spring.Web stuff in Spring.Net 1.1 Preview 2 and is the minimum change I need to do to enable the configuration file to be loaded correctly is change the context type to "Spring.Context.Support.WebApplicationContext" and set the resource uri to "~/config/data.providers.config"?
All I need is to get the objects configuration accessible to the referenced sub assembly in a web application. I don't need to acces any Spring stuff directly in the web project itself. What do I need to do?
Thanks for any help you guys can provide!
James