Bird
0
0

Given the following application.properties snippet:

medium📝 component behavior Q13 of 15
Spring Boot - Application Configuration
Given the following application.properties snippet:
spring.datasource.url=jdbc:mysql://localhost:3306/mydb
spring.datasource.username=root
spring.datasource.password=pass123

What is the effect of this configuration?
AIt sets up a PostgreSQL database connection.
BIt configures a MySQL database connection with the specified URL and credentials.
CIt disables the datasource configuration.
DIt causes a syntax error and fails to start.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the datasource properties

    The keys spring.datasource.url, username, and password configure the database connection details.
  2. Step 2: Identify the database type and credentials

    The URL contains jdbc:mysql://, indicating a MySQL database with host localhost and database mydb. Username and password are set accordingly.
  3. Final Answer:

    It configures a MySQL database connection with the specified URL and credentials. -> Option B
  4. Quick Check:

    Datasource URL with jdbc:mysql = MySQL config [OK]
Quick Trick: Look for jdbc:mysql in URL to identify MySQL config [OK]
Common Mistakes:
  • Assuming PostgreSQL from MySQL URL
  • Thinking this disables datasource
  • Confusing syntax as error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes