Spring is a vast framework, so the Spring framework has been divided into several modules which makes spring lightweight. Some important modules are:

  1. Spring Core
  2. Spring AOP
  3. Spring JDBC
  4. Spring Transaction
  5. Spring ORM
  6. Spring MVC

All the modules of Spring are independent of each other except Spring Core. As Spring core is the base module, so in all module, we have to use Spring Core

Spring Core

Spring Core talking all about dependency management. That means if any arbitrary classes provided to spring then Spring can manage dependency.

What is a dependency:

From the project point of view, in a project or application, multiple classes are there with different functionality. and each class required some functionality of other classes.

Example:

class Engine {

public void start() {

System.out.println("Engine started"); 
}

}



class Car {

public void move() {

// For moving start() method of engine class is required

}

}

Here class Engine is required by class car so we can say the class engine is dependent on class Car, So instead of we managing those dependencies by Inheritance or creating an object as follows.

By Inheritance:

class Engine {

public void start() {

System.out.println("Engine started"); 
}

}

class Car extends Engine {

public void move() {

start(); //Calling super class start method, 
}

}

By creating an object of dependent class:

class Engine {

public void start() {

System.out.println("Engine started"); 
}

}

class Car {

Engine eng = new Engine();

public void move() { eng.start();

}

}

So instead of we managing dependency between classes spring core takes the responsibility dependency management. But Some rule is there, The classes must be designed with some design technique that is Strategy design pattern.

 

<< What is Spring Framework, why should we go for it? 

Understanding How Spring Manage Dependency?>>

By Tell Me How

It is a technology blog and admin has excellent experience in programming from 5+ year. You can contact us at ceo.tellmehow@gmail.com

Share your thoughts

Leave a Reply

Loading Facebook Comments ...
Loading Disqus Comments ...