Q1. What is Spring Boot auto-configuration and how does it work?
Auto-configuration automatically configures Spring beans based on the dependencies present on the classpath. When you add spring-boot-starter-data-jpa, Spring Boot detects Hibernate on the classpath and automatically creates a DataSource, EntityManagerFactory, and transaction manager using values from application.properties. Auto-configuration classes are annotated with @ConditionalOnClass, @ConditionalOnMissingBean, etc., so they only activate when conditions are met. You can exclude specific auto-configuration with @SpringBootApplication(exclude = {...}) or override defaults by defining your own beans — your bean takes precedence.