Bird
0
0

You want to migrate your Spring Boot app configuration from application.yml to application.properties. Which of the following is the correct way to convert this YAML snippet?

hard📝 Application Q15 of 15
Spring Boot - Application Configuration
You want to migrate your Spring Boot app configuration from application.yml to application.properties. Which of the following is the correct way to convert this YAML snippet?
server:
  port: 9090
spring:
  datasource:
    url: jdbc:h2:mem:testdb
    username: sa
    password: ""
Aserver.port=9090 spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.username=sa spring.datasource.password=
Bserver.port : 9090 spring.datasource.url : jdbc:h2:mem:testdb spring.datasource.username : sa spring.datasource.password : ""
Cserver.port => 9090 spring.datasource.url => jdbc:h2:mem:testdb spring.datasource.username => sa spring.datasource.password => ""
Dserver.port9090 spring.datasource.urljdbc:h2:mem:testdb spring.datasource.usernamesa spring.datasource.password""
Step-by-Step Solution
Solution:
  1. Step 1: Understand YAML to properties conversion

    YAML uses indentation and colons, while properties files use dot notation and equals signs.
  2. Step 2: Convert nested YAML keys to dot notation with =

    The nested keys become dot-separated keys, and values are assigned with equals signs. Empty password is represented by an empty value.
  3. Final Answer:

    server.port=9090 spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.username=sa spring.datasource.password= -> Option A
  4. Quick Check:

    YAML nesting = dot notation + = in properties [OK]
Quick Trick: Convert YAML nesting to dot keys with = [OK]
Common Mistakes:
  • Using colon instead of equals in properties
  • Using arrows or spaces instead of =
  • Not converting nested keys to dot notation

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes