Inversion of Control - XML Configuration
Last Updated on: January 12, 2021 pm
Spring Container Functions
- Inversion of Control - Create and Manage Objects
- Dependency Injection - Inject object’s dependencies
Configuring Spring Container
- XML Configuratiion file
- Java annotations
- Java Source Code
Inversion of Control - XML Configuration
Spring Development Process
What is a Spring Bean?
A “Spring Bean” is simply a Java object.
When Java objects are created by the Spring Container, then Spring refers to them as “Spring Beans”.
Spring Beans are created from normal Java classes …. just like Java objects.
1. Configure your Spring Beans
Create a bean and give an id
to it as an alias.
Then specify the classname of the implementation class.
2. Create a Spring Container
- Load the spring configuration file
- Retrieve the bean from the container.
- Call methods in the bean.
- Close the context.
3. Retrieve Beans from Spring Container
Mentioned above.
Reference: Udemy, Spring & Hibernate for Beginners (including SpringBoot)