Package io.smallrye.config
Annotation Interface ConfigMapping
This annotation may be placed in interfaces to group configuration properties with a common prefix.
Example
@ConfigMapping(prefix = "server")
public interface Server {
public String host(); // maps the property name server.host
public int port(); // maps to the property name server.port
}
This annotation is also used in CDI aware environments to scan and register Config Mappings. Otherwise, Config
Mapping interfaces require registration via
SmallRyeConfigBuilder.withMapping(java.lang.Class).- See Also:
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanMatch config mapping method names and configuration properties using bean-style getter names.The naming strategy to use for the config mapping.The prefix of the configuration properties.
-
Element Details
-
prefix
String prefixThe prefix of the configuration properties.- Returns:
- the configuration property prefix
- Default:
""
-
namingStrategy
ConfigMapping.NamingStrategy namingStrategyThe naming strategy to use for the config mapping. This only matters for method names that contain both lower case and upper case characters.- Returns:
- the config mapping naming strategy.
- Default:
KEBAB_CASE
-
beanStyleGetters
boolean beanStyleGettersMatch config mapping method names and configuration properties using bean-style getter names. This removes the prefixesgetorisand decapitalizes the next character. By default, bean-style getter matching isdisabled.Config mapping declarations should prefer to use simple names that match one-to-one with their configuration names. Bean-style getter matching allows multiple method names to match the same configuration name. For instance,
getFooandisFooboth matchfoo, which may not be intended.- Returns:
- a boolean
trueto enable bean style getter names matching, orfalseto disable it.
- Default:
false
-