Annotation Interface PropertySourceExtension
@PropertySource that has some limitations:
- The
@PropertySourceannotation can't auto-refresh theproperty sources - The
@PropertySourceannotation can't control the order ofPropertySource - The
@PropertySourceannotation can't beinherited - The
PropertySource#value()attribute does not support theresourcelocation wildcards - The
PropertySource#encoding()attribute does not specify the default encoding for theresource
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
-
PropertySourcePropertySourcePropertySourceExtensionLoader
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe relative order after specifiedPropertySourcebooleanIt indicates the property source is auto-refreshed when the configuration is changed.The relative order before specifiedPropertySourceA specific character encoding for the given resources.Class<? extends org.springframework.core.io.support.PropertySourceFactory>Specify a customPropertySourceFactory, if any.booleanbooleanIndicate if a failure to find aproperty resourceshould be ignored.Indicate the name of this property source.Class<? extends Comparator<org.springframework.core.io.Resource>>Indicate the resources to be sorted whenvalue()specifies the resource location wildcards or the same resource names with the different absolute paths.String[]Indicate the resource(s) of the property source to be loaded.
-
Element Details
-
name
String nameIndicate the name of this property source.- See Also:
-
PropertySource.getName()Resource.getDescription()
- Default:
- ""
-
autoRefreshed
boolean autoRefreshedIt indicates the property source is auto-refreshed when the configuration is changed.- Returns:
- default value is
false
- Default:
- false
-
first
boolean firstIndicates currentPropertySourceis first order or not If specified ,before()andafter()will be ignored, or last order.- Returns:
- default value is
false
- Default:
- false
-
before
String beforeThe relative order before specifiedPropertySourceIf not specified , current
PropertySourcewill be added last.If
first()specified , current attribute will be ignored.- Returns:
- the name of
PropertySource, default value is the empty string
- Default:
- ""
-
after
String afterThe relative order after specifiedPropertySourceIf not specified , current
PropertySourcewill be added last.If
first()specified , current attribute will be ignored.- Returns:
- the name of
PropertySource, default value is the empty string
- Default:
- ""
-
value
String[] valueIndicate the resource(s) of the property source to be loaded.For example,
"classpath:/com/myco/app.properties"or"file:/path/to/file.xml".Resource wildcards (e.g. **/*.properties) also are permitted;
${...} placeholders will be resolved against any/all property sources already registered with the
Environment.Each value will be added to the enclosing
Environmentas its own property source, and in the order declared.- Default:
- {}
-
resourceComparator
Class<? extends Comparator<org.springframework.core.io.Resource>> resourceComparatorIndicate the resources to be sorted whenvalue()specifies the resource location wildcards or the same resource names with the different absolute paths.For example,
"classpath:/com/myco/*.properties", suppose there are two resources named "a.properties" and "b.properties" where two instances ofResourcewill be resolved, they are the sources ofPropertySource, thus it has to sort them to indicate the order ofPropertySourcethat will be added to the enclosingEnvironment.Default is
DefaultResourceComparator- See Also:
- Default:
- io.microsphere.spring.config.env.support.DefaultResourceComparator.class
-
ignoreResourceNotFound
boolean ignoreResourceNotFoundIndicate if a failure to find aproperty resourceshould be ignored.trueis appropriate if the properties file is completely optional.Default is
false.- Default:
- false
-
encoding
String encodingA specific character encoding for the given resources.Default is "UTF-8"
- Default:
- "UTF-8"
-
factory
Class<? extends org.springframework.core.io.support.PropertySourceFactory> factorySpecify a customPropertySourceFactory, if any.By default, a default factory for standard resource files will be used.
Default is
DefaultPropertySourceFactory- See Also:
-
DefaultPropertySourceFactoryResourcePropertySource
- Default:
- org.springframework.core.io.support.DefaultPropertySourceFactory.class
-