See Also

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

Requirements

Namespace: Spring.Context.Support

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

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

Language

Visual Basic

C#

Show All

See Also Requirements Languages Spring.Core Send comments on this topic.

XmlApplicationContext Class

Spring.Context.Support Namespace : 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.

Object Model






Inheritance Hierarchy

System.Object
   Spring.Core.IO.ConfigurableResourceLoader
      Spring.Context.Support.AbstractApplicationContext
         Spring.Context.Support.AbstractXmlApplicationContext
            Spring.Context.Support.XmlApplicationContext

Syntax

[Visual Basic]
Public Class XmlApplicationContext    Inherits AbstractXmlApplicationContext    Implements IApplicationContextIApplicationEventPublisherIConfigurableApplicationContextIMessageSourceIResourceLoaderIEventRegistryIHierarchicalObjectFactoryIListableObjectFactoryIObjectFactory 
[C#]
public class XmlApplicationContext : AbstractXmlApplicationContext, IApplicationContextIApplicationEventPublisherIConfigurableApplicationContextIMessageSourceIResourceLoaderIEventRegistryIHierarchicalObjectFactoryIListableObjectFactoryIObjectFactory 

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.

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.

[C#] 

// 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

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

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

See Also

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

 

 


© 2004-2006 Spring.NET Authors. All Rights Reserved.