Advanced Spring Boot Configuration Profiles Mastery
Test your expertise in advanced configuration profiles within Spring Boot applications.
Questions in this quiz
10 questions on Advanced Spring Boot Configuration Profiles Mastery. Work through them here, then start the quiz to answer them and see your score.
1.In Spring Boot, which annotation is used to activate a specific profile programmatically?
- A@ActiveProfiles
- B@EnableProfile
- C@Profile
- D@ProfileActive
2.How can you define a default profile in Spring Boot if no profiles are explicitly activated?
- Aspring.active.profile=default
- Bspring.profiles.active=default
- Cspring.default.profile
- Dspring.profiles.default
3.Which of the following is a valid way to include multiple profiles in a Spring Boot application?
- Aspring.active.profiles=dev,prod
- Bspring.include.profiles=dev,prod
- Cspring.profiles.include=dev,prod
- Dspring.profiles.active=dev,prod
4.What is the order of precedence for loading properties in Spring Boot profiles?
- Aapplication-{profile}.yaml, application.yaml
- Bapplication.properties, application-{profile}.properties
- Capplication-{profile}.properties, application.properties
- Dapplication.yaml, application-{profile}.yaml
5.Which method allows programmatic setting of active profiles in a Spring Boot application?
- ASpringApplication.setProfiles()
- BSpringApplicationBuilder.setProfiles()
- CSpringApplicationBuilder.profiles()
- DSpringApplication.setActiveProfiles()
6.How can you conditionally load a bean based on the active profile in Spring Boot?
- A@ConditionalOnActiveProfile
- B@ActiveProfile
- C@ConditionalOnProfile
- D@Profile
7.What is the correct way to specify a profile-specific property in an application.yaml file?
- Aspring.profiles.active: dev
- Bspring.profiles: dev
- Cprofiles: dev
- Dspring: profiles: dev
8.Which command-line argument can be used to activate a specific profile when running a Spring Boot application?
- A--spring.active.profiles=dev
- B--spring.profiles.active=dev
- C--profiles.active=dev
- D--active.profiles=dev
9.How can you exclude a profile from being active in a Spring Boot application?
- Aspring.profiles.exclude
- Bspring.profiles.not-active
- Cspring.profiles.inactive
- Dspring.profiles.deactivate
10.Which of the following is true about profile-specific configuration files in Spring Boot?
- AThey are deprecated in Spring Boot 2.x.
- BThey can override properties in application.properties.
- CThey must be in JSON format.
- DThey cannot be used with YAML files.