Spring Boot Configuration Properties & Profiles: Beginner's Quiz
Test your understanding of configuration properties and profiles in Spring Boot.
Questions in this quiz
15 questions on Spring Boot Configuration Properties & Profiles: Beginner's Quiz. Work through them here, then start the quiz to answer them and see your score.
1.What is the default file name for configuration properties in a Spring Boot application?
- Aapplication.properties
- Bsettings.properties
- Cconfig.properties
- Dspring.properties
2.Which annotation is used to inject configuration properties into a Spring Boot component?
- A@Autowired
- B@ConfigurationProperties
- C@Component
- D@Value
3.How can you specify a different profile in a Spring Boot application?
- AUsing --spring.active
- BUsing --spring.profiles.active
- CUsing --profile.active
- DUsing --active.profile
4.Which file extension is NOT supported for Spring Boot configuration files?
- A.properties
- B.json
- C.xml
- D.yml
5.What is the purpose of Spring Boot profiles?
- ATo separate application configurations for different environments
- BTo handle database migrations
- CTo manage application dependencies
- DTo define security roles
6.Which of the following is a valid way to define a profile-specific property in application.properties?
- Aserver.port.dev=8080
- Bserver.port@dev=8080
- Cserver.port=8080
- Ddev.server.port=8080
7.How do you activate a profile in a Spring Boot application using application.properties?
- Aspring.profiles.active=dev
- Bactive.profile=dev
- Cprofiles.active=dev
- Dspring.active.profile=dev
8.Which annotation is used to mark a class as a configuration properties class?
- A@PropertySource
- B@Configuration
- C@Component
- D@ConfigurationProperties
9.What is the default location for Spring Boot to search for configuration files?
- Asrc/main/resources
- Bsrc/main/webapp
- Csrc/main/java
- Dsrc/main/config
10.Which of the following is a valid YAML configuration for a server port?
- Aserver-port: 8080
- Bserver: port: 8080
- Cserver { port: 8080 }
- Dserver.port: 8080
11.What is the purpose of the @Value annotation in Spring Boot?
- ATo inject beans
- BTo inject configuration properties
- CTo define a configuration class
- DTo handle exceptions
12.How can you include multiple profiles in a Spring Boot application?
- Aspring.profiles.active=dev,test,prod
- Bspring.profiles.active=dev;test
- Cspring.profiles.active=dev,test
- Dspring.profiles.active=dev|test
13.Which command-line argument is used to specify a custom configuration file location?
- A--spring.config.location
- B--spring.config.file
- C--spring.file.path
- D--spring.file.location
14.What is the purpose of the @PropertySource annotation?
- ATo specify the location of a properties file
- BTo activate a profile
- CTo inject beans
- DTo define a configuration class
15.How can you override a property defined in application.properties?
- ABy using a different profile
- BBy defining it in application.yml
- CBy defining it in application.xml
- DBy using a command-line argument