6.4 Summary
- We can annotate Spring beans with
@ConfigurationPropertiesto enable injection of values from one of several property sources. - Configuration properties can be set in command-line arguments, environment variables, JVM system properties, properties files, or YAML files, among other options.
- Use configuration properties to override autoconfiguration settings, including the ability to specify a data source URL and logging levels.
- Spring profiles can be used with property sources to conditionally set configuration properties based on the active profile(s).
