Spring Boot Interview Notes
Spring Boot Interview Notes
- Providing auto-configuration
- Database
Flow:
@SpringBootApplication
SpringApplication.run(MyApp.class, args);
2. Auto-Configuration
3. Component Scanning
@RestController
@Service
@Repository
@Component
It creates beans for them and puts them into the Spring IoC container.
🗄️ How Spring Boot Connects to a Database
In pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>