Spring Boot: Mastering Advanced Configuration Properties
Explore advanced techniques for managing configuration properties in Spring Boot applications.
Questions in this quiz
12 questions on Spring Boot: Mastering Advanced Configuration Properties. Work through them here, then start the quiz to answer them and see your score.
1.Which annotation is used to bind external configuration properties to a Java class in Spring Boot?
- A@EnableConfigurationProperties
- B@PropertySource
- C@ConfigurationProperties
- D@Value
2.How can you specify a custom prefix for properties in a class annotated with @ConfigurationProperties?
- AUsing the 'value' attribute
- BUsing the 'prefix' attribute
- CUsing the 'source' attribute
- DUsing the 'name' attribute
3.What is the role of the @EnableConfigurationProperties annotation in Spring Boot?
- AIt registers @ConfigurationProperties beans
- BIt enables support for @PropertySource
- CIt enables @Value annotations
- DIt loads properties from a file
4.Which file format is NOT supported by Spring Boot for externalized configuration?
- AProperties
- BYAML
- CXML
- DJSON
5.How can you access a property defined in application.properties using the @Value annotation?
- A@Value('${property.name}')
- B@Value('#{property.name}')
- C@Value('${property-name}')
- D@Value('property.name')
6.What is the default order of property sources in Spring Boot?
- ACommand line arguments, application.properties, application.yml
- Bapplication.properties, application.yml, command line arguments
- CCommand line arguments, application.yml, application.properties
- Dapplication.yml, application.properties, command line arguments
7.Which of the following is true about @PropertySource annotation?
- AIt loads properties from a specified file
- BIt binds properties to a class
- CIt enables configuration properties
- DIt is used for YAML files
8.How can you define default values for properties in Spring Boot?
- AUsing @EnableConfigurationProperties
- BUsing @PropertySource
- CUsing @ConfigurationProperties
- DUsing @Value with a colon
9.What is the purpose of the Spring Boot 'Relaxed Binding' feature?
- AIt supports JSON configuration
- BIt allows environment-specific properties
- CIt allows case-insensitive property names
- DIt enables YAML support
10.Which property source has the highest precedence in Spring Boot?
- Aapplication.properties
- BEnvironment variables
- Capplication.yml
- DCommand line arguments
11.How can you specify multiple profiles in a Spring Boot application?
- AUsing a comma-separated list in application.properties
- BUsing @EnableProfiles
- CUsing multiple @Profile annotations
- DUsing @ConfigurationProperties
12.What is the purpose of the 'spring.config.activate.on-profile' property?
- ATo load additional properties
- BTo specify default profiles
- CTo deactivate a profile
- DTo activate a profile based on a condition