Prev Next

Spring / Spring7 basics Interview questions

What is Inversion of Control in Spring?

Inversion of Control (IoC) is the design principle where an object no longer creates or looks up its own collaborators; instead, control over object creation and wiring is handed to a container. In a plain Java program, a class typically instantiates the objects it depends on with new. Under IoC, that responsibility moves outward to the Spring container.

Spring implements IoC through its IoC container, represented by the BeanFactory and ApplicationContext interfaces, which read configuration (annotations, Java config, or XML) and construct, configure, and manage the lifecycle of every bean. The main benefit is loose coupling: classes depend on abstractions rather than concrete implementations, which makes code easier to test, swap, and extend.

Under Inversion of Control, who is responsible for creating and wiring an object's dependencies?
Which two interfaces represent Spring's IoC container?

More Related questions...

What is Spring Framework 7? What is the minimum Java version required by Spring Framework 7? What is Jakarta EE 11 support in Spring Framework 7? What is Inversion of Control in Spring? What is Dependency Injection in Spring? What are the types of Dependency Injection in Spring? What is an ApplicationContext? What is a BeanFactory in Spring? What are Spring beans? What are the types of bean scopes in Spring? What is the purpose of the @Component annotation? What is the purpose of the @Autowired annotation? What is the purpose of the @Configuration annotation? What is the purpose of the @Bean annotation? What are stereotype annotations in Spring? What is component scanning in Spring? What is the BeanRegistrar contract introduced in Spring Framework 7? What is JSpecify in Spring Framework 7? What is the purpose of the @Value annotation? What are Spring profiles? Define a Spring Boot starter? What is auto-configuration in Spring Boot 4? What is the DispatcherServlet in Spring MVC? What is a RestController in Spring MVC? What is API Versioning support in Spring Framework 7? What are the types of HTTP message converters in Spring? Describe the RestClient in Spring Framework 7? What is the purpose of HTTP Interface clients in Spring? What are the types of Spring AOP advice? Define an Aspect in Spring AOP? What is the purpose of the @Transactional annotation? What are the types of transaction propagation in Spring? Describe AOT processing in Spring Framework 7? What is GraalVM native image support in Spring Framework 7? What is virtual thread support in Spring Framework 7? What is the purpose of a PropertySource in Spring? List the core modules of Spring Framework 7? Define a Spring MVC ViewResolver? What is the purpose of ResponseEntity? Describe the Spring Bean lifecycle basics?
Show more question and Answers...


Comments & Discussions