0
0
Spring Bootframework~10 mins

Configuration precedence order in Spring Boot - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the highest precedence configuration source in Spring Boot.

Spring Boot
spring.config.location=[1]
Drag options to blanks, or click blank then click option'
Aenvironment variables
Bapplication.yml
Cclasspath:/application.properties
Dcommand-line arguments
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing environment variables instead of command-line arguments
Confusing classpath properties with runtime overrides
2fill in blank
medium

Complete the code to indicate the default configuration file Spring Boot loads from the classpath.

Spring Boot
spring.config.name=[1]
Drag options to blanks, or click blank then click option'
Aapplication.properties
Bapplication
Capplication.yml
Dconfig
Attempts:
3 left
💡 Hint
Common Mistakes
Including the file extension in the config name
Using 'config' instead of 'application'
3fill in blank
hard

Fix the error in the code to correctly specify a profile-specific configuration file in Spring Boot.

Spring Boot
spring.config.location=classpath:/application-[1].properties
Drag options to blanks, or click blank then click option'
Adev
Bdefault
Cactive
Dprofile
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'profile' or 'active' literally instead of the profile name
Using 'default' which is not a profile
4fill in blank
hard

Fill both blanks to complete the code that sets the order of configuration precedence: first environment variables, then {{BLANK_1}}.

Spring Boot
spring.config.import=optional:configtree:./config/,{{BLANK_2}}
Drag options to blanks, or click blank then click option'
Aapplication.properties
Bcommand-line arguments
Cclasspath:/application.properties
Denvironment variables
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of command-line arguments and classpath properties
Confusing environment variables with configtree
5fill in blank
hard

Fill all three blanks to complete the code that defines a configuration property with a default value, overridden by {{BLANK_1}}, then {{BLANK_2}}, and finally {{BLANK_3}}.

Spring Boot
spring.config.override=[1],[2],[3]
Drag options to blanks, or click blank then click option'
Aapplication.properties
Benvironment variables
Ccommand-line arguments
Dprofile-specific properties
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the order of environment variables and command-line arguments
Including profile-specific properties in the wrong position