Bird
0
0

You want to disable Spring Boot's auto-configuration for JPA but keep others enabled. Which is the correct way to do this?

hard📝 Application Q15 of 15
Spring Boot - Fundamentals
You want to disable Spring Boot's auto-configuration for JPA but keep others enabled. Which is the correct way to do this?
ARemove all dependencies except JPA starter
BAdd <code>@SpringBootApplication(exclude = JpaAutoConfiguration.class)</code> on main class
CSet <code>spring.autoconfigure.enabled=false</code> in application.properties
DDelete the <code>spring.factories</code> file from the jar
Step-by-Step Solution
Solution:
  1. Step 1: Identify how to exclude specific auto-config

    Spring Boot allows excluding specific auto-config classes using the exclude attribute on @SpringBootApplication.
  2. Step 2: Evaluate other options

    Removing dependencies disables features but is not selective; disabling all auto-config is too broad; deleting spring.factories breaks the framework.
  3. Final Answer:

    Add @SpringBootApplication(exclude = JpaAutoConfiguration.class) on main class -> Option B
  4. Quick Check:

    Exclude specific auto-config via annotation [OK]
Quick Trick: Use exclude attribute on @SpringBootApplication [OK]
Common Mistakes:
  • Disabling all auto-config instead of one
  • Removing dependencies instead of excluding config
  • Modifying internal Spring Boot files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes