Upload
nazim-sitmanbetov
View
237
Download
2
Tags:
Embed Size (px)
Citation preview
Spring Framework & Inversion of Control
By Nazim Sitmanbetov
Preconditions Keep calm Sit back Relax
Inversion of Control OOP principle, not design pattern One of
Principle in OOP Modules depend on abstractions Low level modules do not depend on
high level modules
Modules depend on abstractions
Bad Good
Low level modules do not depend on high level modules
Bad Good
Tip: Avoid cyclic dependencies
IoC implementations Factory Method Service Locator Dependency Injection (DI)
Factory Method
Service Locator
Dependency Injection Allow client of module to set
dependencyModule Client
Achievement unlocked
Framework
Java Light-weight Open Source
What means Light-Weight? No container requirements Quick start Application easy-to-test
Spring & IoC Dependency Injection Service Locator
Spring & Dependency InjectionXML Based Configurationmcdonalds-with-kazatin.xml
Java Program
Spring & Service LocatorAnnotation Basedmcdonalds-locator.xml
Spring & Service Locator
Dependency Injection vs Service Locator
DI Service Locator
• Imperative• Can be used with
existing classes
• Declarative• Need to modify
existing classes
Spring components
Time to cook