Top Description Inners Fields Methods
org.eclipse.microprofile.config.inject

public @Interface ConfigProperties

extends Annotation
Known Direct Implementers
org.eclipse.microprofile.config.inject.ConfigProperties.Literal
Annotations
@Target:METHOD, FIELD, PARAMETER, TYPE
@Retention:RUNTIME
@Documented
@Qualifier
Static Imports
java.lang.annotation.ElementType.FIELD, .ElementType.METHOD, .ElementType.PARAMETER, .ElementType.TYPE, .RetentionPolicy.RUNTIME

Retrieve a number of related configuration properties with the specified prefix into a property class. This class should contain a zero-arg constructor. Otherwise, non-portable behaviour occurs.

Example

@ConfigProperties(prefix = "server")
@Dependent
public class MyServer {
    public String host; // maps the property name server.host
    public int port; // maps to the property name server.port
    private String context; // maps to the property name server.context
    @ConfigProperty(name = "old.location")
    public String location; // maps to the property name server.old.location
    public String getContext() {
        return context;
    }
}
Author
Emily Jiang
Since
2.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
ConfigProperties.Literal

Support inline instantiation of the ConfigProperties qualifier.

Field Summary

Modifier and TypeField and Description
public static final String

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the configuration property prefix
prefix
()

The prefix of the configuration properties.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Field Detail

UNCONFIGURED_PREFIXback to summary
public static final String UNCONFIGURED_PREFIX

Method Detail

prefixback to summary
public String prefix()

The prefix of the configuration properties.

Returns:String

the configuration property prefix

Annotations
@Nonbinding
org.eclipse.microprofile.config.inject back to summary

public final Class ConfigProperties.Literal

extends AnnotationLiteral<ConfigProperties>
implements ConfigProperties
Class Inheritance
All Implemented Interfaces
org.eclipse.microprofile.config.inject.ConfigProperties, java.lang.annotation.Annotation

Support inline instantiation of the ConfigProperties qualifier.

Field Summary

Modifier and TypeField and Description
public static final ConfigProperties.Literal
private final String
private static final long

Constructor Summary

AccessConstructor and Description
private
Literal(String prefix)

Method Summary

Modifier and TypeMethod and Description
public static ConfigProperties.Literal
of(String prefix)

public String
prefix()

Implements org.eclipse.microprofile.config.inject.ConfigProperties.prefix.

The prefix of the configuration properties.

Inherited from jakarta.enterprise.util.AnnotationLiteral:
annotationTypeequalshashCodetoString

Field Detail

NO_PREFIXback to summary
public static final ConfigProperties.Literal NO_PREFIX
prefixback to summary
private final String prefix
serialVersionUIDback to summary
private static final long serialVersionUID

Hides jakarta.enterprise.util.AnnotationLiteral.serialVersionUID.

Constructor Detail

Literalback to summary
private Literal(String prefix)

Method Detail

ofback to summary
public static ConfigProperties.Literal of(String prefix)
prefixback to summary
public String prefix()

Implements org.eclipse.microprofile.config.inject.ConfigProperties.prefix.

Doc from org.eclipse.microprofile.config.inject.ConfigProperties.prefix.

The prefix of the configuration properties.

Returns:String

the configuration property prefix

Annotations
@Override