Package com.alibaba.cloud.nacos.parser
Class NacosXmlPropertySourceLoader
java.lang.Object
com.alibaba.cloud.nacos.parser.AbstractPropertySourceLoader
com.alibaba.cloud.nacos.parser.NacosXmlPropertySourceLoader
- All Implemented Interfaces:
org.springframework.boot.env.PropertySourceLoader,org.springframework.core.Ordered
public class NacosXmlPropertySourceLoader
extends AbstractPropertySourceLoader
implements org.springframework.core.Ordered
Parsing for XML requires overwriting the default
PropertiesPropertySourceLoader, because it internally rigorously validates
(DOCTYPE) THE XML in a way that makes it difficult to customize the
configuration; at finally, make sure it's in the first place.- Author:
- zkz
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.alibaba.cloud.nacos.parser.AbstractPropertySourceLoader
canLoad, flattenedMap, load
-
Constructor Details
-
NacosXmlPropertySourceLoader
public NacosXmlPropertySourceLoader()
-
-
Method Details
-
getOrder
public int getOrder()Get the order value of this object.Higher values are interpreted as lower priority. As a consequence, the object with the lowest value has the highest priority (somewhat analogous to Servlet
load-on-startupvalues).Same order values will result in arbitrary sort positions for the affected objects.
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered- Returns:
- the order value
- See Also:
-
Ordered.HIGHEST_PRECEDENCEOrdered.LOWEST_PRECEDENCE
-
getFileExtensions
Returns the file extensions that the loader supports (excluding the '.').- Specified by:
getFileExtensionsin interfaceorg.springframework.boot.env.PropertySourceLoader- Returns:
- the file extensions
-
doLoad
protected List<org.springframework.core.env.PropertySource<?>> doLoad(String name, org.springframework.core.io.Resource resource) throws IOException Load the resource into one or more property sources. Implementations may either return a list containing a single source, or in the case of a multi-document format such as yaml a source for each document in the resource.- Specified by:
doLoadin classAbstractPropertySourceLoader- Parameters:
name- the root name of the property source. If multiple documents are loaded an additional suffix should be added to the name for each source loaded.resource- the resource to load- Returns:
- a list property sources
- Throws:
IOException- if the source cannot be loaded
-