Class DefaultNamespaceHandlerResolver
- java.lang.Object
- org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver
- All Implemented Interfaces:
NamespaceHandlerResolver
public class DefaultNamespaceHandlerResolver extends Object implements NamespaceHandlerResolver
Default implementation of theNamespaceHandlerResolverinterface. Resolves namespace URIs to implementation classes based on the mappings contained in mapping file.By default, this implementation looks for the mapping file at
META-INF/spring.handlers, but this can be changed using theDefaultNamespaceHandlerResolver(ClassLoader, String)constructor.- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
NamespaceHandler,DefaultBeanDefinitionDocumentReader
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_HANDLER_MAPPINGS_LOCATIONThe location to look for the mapping files.protected LogloggerLogger available to subclasses
Constructor Summary
Constructors Constructor Description DefaultNamespaceHandlerResolver()Create a newDefaultNamespaceHandlerResolverusing the default mapping file location.DefaultNamespaceHandlerResolver(ClassLoader classLoader)Create a newDefaultNamespaceHandlerResolverusing the default mapping file location.DefaultNamespaceHandlerResolver(ClassLoader classLoader, String handlerMappingsLocation)Create a newDefaultNamespaceHandlerResolverusing the supplied mapping file location.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NamespaceHandlerresolve(String namespaceUri)Locate theNamespaceHandlerfor the supplied namespace URI from the configured mappings.StringtoString()
Field Detail
DEFAULT_HANDLER_MAPPINGS_LOCATION
public static final String DEFAULT_HANDLER_MAPPINGS_LOCATION
The location to look for the mapping files. Can be present in multiple JAR files.- See Also:
- Constant Field Values
Constructor Detail
DefaultNamespaceHandlerResolver
public DefaultNamespaceHandlerResolver()
Create a newDefaultNamespaceHandlerResolverusing the default mapping file location.This constructor will result in the thread context ClassLoader being used to load resources.
- See Also:
DEFAULT_HANDLER_MAPPINGS_LOCATION
DefaultNamespaceHandlerResolver
public DefaultNamespaceHandlerResolver(ClassLoader classLoader)
Create a newDefaultNamespaceHandlerResolverusing the default mapping file location.- Parameters:
classLoader- theClassLoaderinstance used to load mapping resources (may benull, in which case the thread context ClassLoader will be used)- See Also:
DEFAULT_HANDLER_MAPPINGS_LOCATION
DefaultNamespaceHandlerResolver
public DefaultNamespaceHandlerResolver(ClassLoader classLoader, String handlerMappingsLocation)
Create a newDefaultNamespaceHandlerResolverusing the supplied mapping file location.- Parameters:
classLoader- theClassLoaderinstance used to load mapping resources may benull, in which case the thread context ClassLoader will be used)handlerMappingsLocation- the mapping file location
Method Detail
resolve
public NamespaceHandler resolve(String namespaceUri)
Locate theNamespaceHandlerfor the supplied namespace URI from the configured mappings.- Specified by:
resolvein interfaceNamespaceHandlerResolver- Parameters:
namespaceUri- the relevant namespace URI- Returns:
- the located
NamespaceHandler, ornullif none found