| Start |
|---|
| Introduction to Spring Core Spring is a vast framework, so the Spring framework has been divided in several modules which makes spring lightweight. Some important modules are:
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: Example: Here class Engine is required by class car so we can say class engine is dependent to class Car, So instead of we managing those dependency by Inheritance or creating object as fallows. By Inheritance: By creating object of dependent class: So instead of we managing dependency between classes spring core takes the responsibility dependency management. But Some rule are there, The classes must be designed with some design technique that is Strategy design pattern. |
| Understanding How Spring Manage Dependency ? Let me write a piece of code which shows completely loosely coupled, Then you can easily understand how Spring core manage the dependency internally. Consider an scenario, Online business Flipkart is there, it uses some times DTDC or Blue Dart courier service , So let me design a application which shows complete loosely coupled. The Eclipse Directory as fallows: //implementation classes //Component classe //Factory classes to create and return Object //properties file //Test class If we write this code then we can manually achieve loose coupling,this is applicable if all the classes want either BlueDart or Dtdc , But if some class want BlueDart and some other class want Dtdc then again it will be tightly coupled, So instead of we creating and managing the dependency injection Spring core takes the responsibility of creating and managing the beans, Hope This will helpful, in next example we wil see the !st application on Spring core with deitals |
Read Article
https://develop.horje.com/learn/1434/reference