Recall & Review
beginner
What is the purpose of custom configuration properties in Spring Boot?
Custom configuration properties allow you to define your own settings in application.properties or application.yml files and bind them to Java classes for easy and type-safe access.
Click to reveal answer
beginner
How do you bind custom properties to a Java class in Spring Boot?You create a Java class with fields matching the property names and annotate it with @ConfigurationProperties(prefix = "your.prefix"). Then, register it as a bean with @Component or @EnableConfigurationProperties.Click to reveal answer
intermediate
What annotation is used to enable support for @ConfigurationProperties classes in Spring Boot?
The @EnableConfigurationProperties annotation enables support for @ConfigurationProperties classes, allowing Spring Boot to bind external properties to your Java beans.
Click to reveal answer
intermediate
Why is it recommended to use custom configuration properties instead of @Value annotations for many related settings?
Using custom configuration properties groups related settings in one class, making the code cleaner, easier to maintain, and type-safe compared to scattering many @Value annotations.
Click to reveal answer
advanced
How can you validate custom configuration properties in Spring Boot?
You add validation annotations like @NotNull or @Min on fields in your @ConfigurationProperties class and annotate the class with @Validated to enforce validation when properties are loaded.Click to reveal answer
Which annotation do you use to bind external properties to a Java class in Spring Boot?
✗ Incorrect
The @ConfigurationProperties annotation binds external properties to a Java class based on a prefix.
Where do you typically define custom configuration properties in a Spring Boot project?
✗ Incorrect
Custom configuration properties are defined in application.properties or application.yml files.
What is the benefit of using @EnableConfigurationProperties?
✗ Incorrect
@EnableConfigurationProperties activates support for @ConfigurationProperties classes.
How do you ensure that your custom configuration properties are validated?
✗ Incorrect
Adding @Validated and validation annotations like @NotNull ensures properties are checked when loaded.
What prefix would you use in @ConfigurationProperties(prefix = "app.settings") to bind properties?
✗ Incorrect
The prefix in @ConfigurationProperties matches the start of property keys in the config files.
Explain how to create and use custom configuration properties in Spring Boot.
Think about how Spring Boot connects external settings to Java classes.
You got /5 concepts.
Describe how validation works for custom configuration properties in Spring Boot.
Consider how Spring Boot ensures your settings are correct before running.
You got /4 concepts.