- Spring - Logging with Log4J
- Spring - Web MVC Framework
- Spring - Transaction Management
- Spring - JDBC Framework
- Spring - AOP with Spring Framework
- Spring - Custom Events in Spring
- Spring - Event Handling in Spring
- Spring - Java Based Configuration
- Annotation Based Configuration
- Spring - Beans Auto-Wiring
- Spring - Injecting Collection
- Spring - Injecting Inner Beans
- Spring - Dependency Injection
- Spring - Bean Definition Inheritance
- Spring - Bean Post Processors
- Spring - Bean Life Cycle
- Spring - Bean Scopes
- Spring - Bean Definition
- Spring - IoC Containers
- Spring - Hello World Example
- Spring - Environment Setup
- Spring - Architecture
- Spring - Overview
- Spring - Home
Spring Questions and Answers
Spring Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Spring - IoC Containers
The Spring container is at the core of the Spring Framework. The container will create the objects, wire them together, configure them, and manage their complete pfe cycle from creation till destruction. The Spring container uses DI to manage the components that make up an apppcation. These objects are called Spring Beans, which we will discuss in the next chapter.
The container gets its instructions on what objects to instantiate, configure, and assemble by reading the configuration metadata provided. The configuration metadata can be represented either by XML, Java annotations, or Java code. The following diagram represents a high-level view of how Spring works. The Spring IoC container makes use of Java POJO classes and configuration metadata to produce a fully configured and executable system or apppcation.
Spring provides the following two distinct types of containers.
Sr.No. | Container & Description |
---|---|
1 | This is the simplest container providing the basic support for DI and is defined by the org.springframework.beans.factory.BeanFactory interface. The BeanFactory and related interfaces, such as BeanFactoryAware, InitiapzingBean, DisposableBean, are still present in Spring for the purpose of backward compatibipty with a large number of third-party frameworks that integrate with Spring. |
2 | This container adds more enterprise-specific functionapty such as the abipty to resolve textual messages from a properties file and the abipty to pubpsh apppcation events to interested event psteners. This container is defined by the org.springframework.context.ApppcationContext interface. |
The ApppcationContext container includes all functionapty of the BeanFactorycontainer, so it is generally recommended over BeanFactory. BeanFactory can still be used for pghtweight apppcations pke mobile devices or applet-based apppcations where data volume and speed is significant.
Advertisements