Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

XmlApplicationContext Class

An IApplicationContext implementation that reads context definitions from XML based resources.

For a list of all members of this type, see XmlApplicationContext Members .

System.Object
   ConfigurableResourceLoader
      AbstractApplicationContext
         AbstractXmlApplicationContext
            XmlApplicationContext

[Visual Basic]
<DefaultMember(MemberName:="Item")> _
Public Class XmlApplicationContext
    Inherits AbstractXmlApplicationContext
[C#]
[DefaultMember(MemberName="Item")]
public class XmlApplicationContext : AbstractXmlApplicationContext

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Currently, the resources that are supported are the file, http, ftp, config and assembly resource types.

You can provide custom implementations of the IResource interface and and register them with any IApplicationContext that inherits from the AbstractApplicationContext interface.

Note    In case of multiple config locations, later object definitions will override ones defined in previously loaded resources. This can be leveraged to deliberately override certain object definitions via an extra XML file.

Example

Find below some examples of instantiating an XmlApplicationContext using a variety of different XML resources.

// an XmlApplicationContext that reads its object definitions from an
//    XML file that has been embedded in an assembly...
IApplicationContext context = new XmlApplicationContext
    (
        "assembly://AssemblyName/NameSpace/ResourceName"
    );
    
// an XmlApplicationContext that reads its object definitions from a
//    number of disparate XML resources...
IApplicationContext context = new XmlApplicationContext
    (
        // from an XML file that has been embedded in an assembly...
        "assembly://AssemblyName/NameSpace/ResourceName",
        // and from a (relative) filesystem-based resource...
        "file://Objects/services.xml",
        // and from an App.config / Web.config resource...
        "config://spring/objects"
    );

Requirements

Namespace: Spring.Context.Support

Assembly: Spring.Core (in Spring.Core.dll)

See Also

XmlApplicationContext Members | Spring.Context.Support Namespace | IResource | IResourceLoader | ConfigurableResourceLoader