Class DefaultNamespaceHandlerResolver
java.lang.Object
org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver
- All Implemented Interfaces:
NamespaceHandlerResolver
Default implementation of the
NamespaceHandlerResolver
interface.
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 the
DefaultNamespaceHandlerResolver(ClassLoader, String)
constructor.
- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreate a newDefaultNamespaceHandlerResolver
using the default mapping file location.DefaultNamespaceHandlerResolver
(ClassLoader classLoader) Create a newDefaultNamespaceHandlerResolver
using the default mapping file location.DefaultNamespaceHandlerResolver
(ClassLoader classLoader, String handlerMappingsLocation) Create a newDefaultNamespaceHandlerResolver
using the supplied mapping file location. -
Method Summary
Modifier and TypeMethodDescriptionLocate theNamespaceHandler
for the supplied namespace URI from the configured mappings.toString()
-
Field Details
-
DEFAULT_HANDLER_MAPPINGS_LOCATION
The location to look for the mapping files. Can be present in multiple JAR files.- See Also:
-
logger
Logger available to subclasses.
-
-
Constructor Details
-
DefaultNamespaceHandlerResolver
public DefaultNamespaceHandlerResolver()Create a newDefaultNamespaceHandlerResolver
using the default mapping file location.This constructor will result in the thread context ClassLoader being used to load resources.
- See Also:
-
DefaultNamespaceHandlerResolver
Create a newDefaultNamespaceHandlerResolver
using the default mapping file location.- Parameters:
classLoader
- theClassLoader
instance used to load mapping resources (may benull
, in which case the thread context ClassLoader will be used)- See Also:
-
DefaultNamespaceHandlerResolver
public DefaultNamespaceHandlerResolver(@Nullable ClassLoader classLoader, String handlerMappingsLocation) Create a newDefaultNamespaceHandlerResolver
using the supplied mapping file location.- Parameters:
classLoader
- theClassLoader
instance used to load mapping resources may benull
, in which case the thread context ClassLoader will be usedhandlerMappingsLocation
- the mapping file location
-
-
Method Details
-
resolve
Locate theNamespaceHandler
for the supplied namespace URI from the configured mappings.- Specified by:
resolve
in interfaceNamespaceHandlerResolver
- Parameters:
namespaceUri
- the relevant namespace URI- Returns:
- the located
NamespaceHandler
, ornull
if none found
-
toString
-