Spring / Spring7 basics Interview questions
What is a BeanFactory in Spring?
BeanFactory is the root interface of Spring's IoC container - it defines the core contract for holding bean definitions and producing bean instances on request, including support for dependency injection, bean scopes, and lifecycle callbacks. It is intentionally minimal and lightweight compared to ApplicationContext.
In practice, almost no application code uses BeanFactory directly anymore. ApplicationContext is a subinterface that adds AOP integration, event handling, and easier configuration, so it's the interface every Spring Boot or Spring MVC application actually works with. BeanFactory still matters conceptually because it's where lazy bean instantiation and the basic getBean() contract are defined.
More Related questions...