Spring Core - IoC & DI
Inversion of Control, Dependency Injection, annotations (@Component, @Autowired, @Bean), scopes, bean lifecycle
1What is Inversion of Control (IoC) in Spring?
What is Inversion of Control (IoC) in Spring?
Odpowiedź
IoC is a principle where the Spring framework manages object creation and lifecycle, rather than the developer. This reverses the traditional control flow where application code directly instantiates its dependencies. Spring uses an IoC container to manage beans and their dependencies declaratively.
2What is a bean in Spring?
What is a bean in Spring?
Odpowiedź
A bean is an object managed by the Spring IoC container. It is instantiated, configured and assembled by Spring according to configuration metadata (annotations, XML or Java config). Beans are the core of a Spring application and benefit from dependency injection.
3What is the purpose of the @Component annotation?
What is the purpose of the @Component annotation?
Odpowiedź
The @Component annotation marks a class as a Spring bean to be automatically detected during component scanning enabled by @ComponentScan. Spring creates an instance of this class and places it in the IoC container with a default name (class in camelCase). It's the generic stereotype annotation from which @Service, @Repository and @Controller derive to bring specific business semantics.
What are the three types of dependency injection in Spring?
How does the @Autowired annotation work?
+19 pytań z rozmów
Inne tematy rekrutacyjne Spring Boot
Spring Boot Auto-Configuration
Spring Boot Starters
Application Properties & YAML
Logging with SLF4J & Logback
Spring Boot DevTools
Spring MVC Basics
Spring REST Controllers
Request & Response Handling
Exception Handling
Bean Validation
Spring Data JPA Basics
JPA Entities & Relationships
JPA Queries
Spring Data Repositories
Spring Security Basics
Spring Boot Actuator
Unit Testing with JUnit & Mockito
Spring Boot Testing
Profiles & Environment
RestTemplate & WebClient
Async & Scheduling
Caching with Spring
Spring WebFlux (Reactive)
Spring Transactions
Advanced Authentication & Authorization
JWT & Stateless Security
OAuth2 & Authorization Server
Spring Boot & Docker
Microservices with Spring
Spring Cloud Config
Performance Optimization
GraalVM Native Images
Opanuj Spring Boot na następną rozmowę
Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.
Zacznij za darmo