Skip to content

@ConfigurationProperties binding

@ConfigurationProperties is a mechanism in Spring Boot used to bind external configuration (from properties files, YAML files, or environment variables) to strongly-typed Java classes.^[600-developer__spring__springboot.md]

Prefix Mapping

The @ConfigurationProperties annotation utilizes a name attribute to define a prefix that acts as a filter for external properties.^[600-developer__spring__springboot.md#L115-L118] For example, a class like ServerProperties typically uses the prefix "server", mapping properties such as server.port and server.address to the fields within that class.^[600-developer__spring__springboot.md#L115-L118]

Verification and Inspection

When the Spring Boot Actuator is enabled in an application, the specific configuration properties being bound can be inspected using the configprops endpoint.^[600-developer__spring__springboot.md#L115-L118]

  • Spring Boot
  • [[External Configuration]]
  • [[Actuator Endpoints]]

Sources

  • 600-developer__spring__springboot.md