Annotation Interface ConfigurationProperties
@Target({TYPE,METHOD})
@Retention(RUNTIME)
@Documented
@Indexed
public @interface ConfigurationProperties
Annotation for externalized configuration. Add this to a class definition or a
@Bean
method in a @Configuration
class if you want to bind and validate
some external Properties (e.g. from a .properties file).
Binding is either performed by calling setters on the annotated class or, if
@ConstructorBinding
is in use, by binding to the constructor
parameters.
Note that contrary to @Value
, SpEL expressions are not evaluated since property
values are externalized.
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Flag to indicate that when binding to this object invalid fields should be ignored.boolean
Flag to indicate that when binding to this object unknown fields should be ignored.The prefix of the properties that are valid to bind to this object.The prefix of the properties that are valid to bind to this object.
-
Element Details
-
value
The prefix of the properties that are valid to bind to this object. Synonym forprefix()
. A valid prefix is defined by one or more words separated with dots (e.g."acme.system.feature"
).- Returns:
- the prefix of the properties to bind
- Default:
- ""
-
prefix
The prefix of the properties that are valid to bind to this object. Synonym forvalue()
. A valid prefix is defined by one or more words separated with dots (e.g."acme.system.feature"
).- Returns:
- the prefix of the properties to bind
- Default:
- ""
-
ignoreInvalidFields
boolean ignoreInvalidFieldsFlag to indicate that when binding to this object invalid fields should be ignored. Invalid means invalid according to the binder that is used, and usually this means fields of the wrong type (or that cannot be coerced into the correct type).- Returns:
- the flag value (default false)
- Default:
- false
-
ignoreUnknownFields
boolean ignoreUnknownFieldsFlag to indicate that when binding to this object unknown fields should be ignored. An unknown field could be a sign of a mistake in the Properties.- Returns:
- the flag value (default true)
- Default:
- true
-