注释类型 ResourcePropertySource
-
@Target(TYPE) @Retention(RUNTIME) @Inherited @Documented @PropertySourceExtension @Repeatable(ResourcePropertySources.class) @Import(ResourcePropertySourceLoader.class) public @interface ResourcePropertySource
A variant of the@PropertySourceannotation that has some limitations:- The
@PropertySourceannotation can't meta-annotate the another annotation - 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
Annotation providing a convenient and declarative mechanism for adding a
PropertySourceto Spring's Environment. To be used in conjunction with@Configurationclasses.- 从以下版本开始:
- 1.0.0
- 作者:
- Mercy
- 另请参阅:
PropertySource,ResourcePropertySource,PropertySource,Configuration
- The
-
-
可选元素概要
可选元素 修饰符和类型 可选元素 说明 java.lang.StringafterThe relative order after specifiedPropertySourcebooleanautoRefreshedIt indicates the property source is auto-refreshed when the configuration is changed.java.lang.StringbeforeThe relative order before specifiedPropertySourcejava.lang.StringencodingA specific character encoding for the given resources.java.lang.Class<? extends org.springframework.core.io.support.PropertySourceFactory>factorySpecify a customPropertySourceFactory, if any.booleanfirstbooleanignoreResourceNotFoundIndicate if a failure to find aproperty resourceshould be ignored.java.lang.StringnameIndicate the name of this property source.java.lang.Class<? extends java.util.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.java.lang.String[]valueIndicate the resource location(s) of the property source file to be loaded.
-
-
-
元素详细资料
-
name
@AliasFor(annotation=PropertySourceExtension.class) java.lang.String name
Indicate the name of this property source.- 另请参阅:
PropertySource.getName(),Resource.getDescription()
- 默认值:
- ""
-
-
-
autoRefreshed
@AliasFor(annotation=PropertySourceExtension.class) boolean autoRefreshed
It indicates the property source is auto-refreshed when the configuration is changed.- 返回:
- default value is
false
- 默认值:
- false
-
-
-
first
@AliasFor(annotation=PropertySourceExtension.class) boolean first
Indicates currentPropertySourceis first order or not If specified ,before()andafter()will be ignored, or last order.- 返回:
- default value is
false
- 默认值:
- false
-
-
-
before
@AliasFor(annotation=PropertySourceExtension.class) java.lang.String before
The relative order before specifiedPropertySourceIf not specified , current
PropertySourcewill be added last.If
first()specified , current attribute will be ignored.- 返回:
- the name of
PropertySource, default value is the empty string
- 默认值:
- ""
-
-
-
after
@AliasFor(annotation=PropertySourceExtension.class) java.lang.String after
The relative order after specifiedPropertySourceIf not specified , current
PropertySourcewill be added last.If
first()specified , current attribute will be ignored.- 返回:
- the name of
PropertySource, default value is the empty string
- 默认值:
- ""
-
-
-
value
@AliasFor(annotation=PropertySourceExtension.class) java.lang.String[] value
Indicate the resource location(s) of the property source file to be loaded.Both traditional and XML-based properties file formats are supported — for example,
"classpath:/com/myco/app.properties"or"file:/path/to/file.xml".Resource location wildcards (e.g. **/*.properties) also are permitted;
${...} placeholders will be resolved against any/all property sources already registered with the
Environment.Each location will be added to the enclosing
Environmentas its own property source, and in the order declared.- 默认值:
- {}
-
-
-
resourceComparator
@AliasFor(annotation=PropertySourceExtension.class) java.lang.Class<? extends java.util.Comparator<org.springframework.core.io.Resource>> resourceComparator
Indicate 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- 默认值:
- io.microsphere.spring.config.env.support.DefaultResourceComparator.class
-
-
-
ignoreResourceNotFound
@AliasFor(annotation=PropertySourceExtension.class) boolean ignoreResourceNotFound
Indicate if a failure to find aproperty resourceshould be ignored.trueis appropriate if the properties file is completely optional.Default is
false.- 默认值:
- false
-
-
-
encoding
@AliasFor(annotation=PropertySourceExtension.class) java.lang.String encoding
A specific character encoding for the given resources.Default is "UTF-8"
- 默认值:
- "UTF-8"
-
-
-
factory
@AliasFor(annotation=PropertySourceExtension.class) java.lang.Class<? extends org.springframework.core.io.support.PropertySourceFactory> factory
Specify a customPropertySourceFactory, if any.By default, a default factory for standard resource files will be used.
Default is
DefaultPropertySourceFactory- 另请参阅:
DefaultPropertySourceFactory,ResourcePropertySource
- 默认值:
- org.springframework.core.io.support.DefaultPropertySourceFactory.class
-
-