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.

Config Beans

2. Create a Spring Container

  1. Load the spring configuration file
  2. Retrieve the bean from the container.
  3. Call methods in the bean.
  4. Close the context.

Create a Spring Container

3. Retrieve Beans from Spring Container

Mentioned above.

Reference: Udemy, Spring & Hibernate for Beginners (including SpringBoot)