Class PluggableSchemaResolver
- java.lang.Object
- org.springframework.beans.factory.xml.PluggableSchemaResolver
- All Implemented Interfaces:
EntityResolver
public class PluggableSchemaResolver extends Object implements EntityResolver
EntityResolverimplementation that attempts to resolve schema URLs into localclasspath resourcesusing a set of mappings files.By default, this class will look for mapping files in the classpath using the pattern:
META-INF/spring.schemasallowing for multiple files to exist on the classpath at any one time.The format of
META-INF/spring.schemasis a properties file where each line should be of the formsystemId=schema-locationwhereschema-locationshould also be a schema file in the classpath. SincesystemIdis commonly a URL, one must be careful to escape any ':' characters which are treated as delimiters in properties files.The pattern for the mapping files can be overridden using the
PluggableSchemaResolver(ClassLoader, String)constructor.- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SCHEMA_MAPPINGS_LOCATIONThe location of the file that defines schema mappings.
Constructor Summary
Constructors Constructor Description PluggableSchemaResolver(ClassLoader classLoader)Loads the schema URL -> schema file location mappings using the default mapping file pattern "META-INF/spring.schemas".PluggableSchemaResolver(ClassLoader classLoader, String schemaMappingsLocation)Loads the schema URL -> schema file location mappings using the given mapping file pattern.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputSourceresolveEntity(String publicId, String systemId)StringtoString()
Field Detail
DEFAULT_SCHEMA_MAPPINGS_LOCATION
public static final String DEFAULT_SCHEMA_MAPPINGS_LOCATION
The location of the file that defines schema mappings. Can be present in multiple JAR files.- See Also:
- Constant Field Values
Constructor Detail
PluggableSchemaResolver
public PluggableSchemaResolver(@Nullable ClassLoader classLoader)
Loads the schema URL -> schema file location mappings using the default mapping file pattern "META-INF/spring.schemas".- Parameters:
classLoader- the ClassLoader to use for loading (can benull) to use the default ClassLoader)- See Also:
PropertiesLoaderUtils.loadAllProperties(String, ClassLoader)
PluggableSchemaResolver
public PluggableSchemaResolver(@Nullable ClassLoader classLoader, String schemaMappingsLocation)
Loads the schema URL -> schema file location mappings using the given mapping file pattern.- Parameters:
classLoader- the ClassLoader to use for loading (can benull) to use the default ClassLoader)schemaMappingsLocation- the location of the file that defines schema mappings (must not be empty)- See Also:
PropertiesLoaderUtils.loadAllProperties(String, ClassLoader)
Method Detail
resolveEntity
@Nullable public InputSource resolveEntity(@Nullable String publicId, @Nullable String systemId) throws IOException
- Specified by:
resolveEntityin interfaceEntityResolver- Throws:
IOException