SlideShare une entreprise Scribd logo
1  sur  39
Spring Fundamentals Doing it right ….inversely
Agenda Why DI and SL vs DI. Dependency injection and The Spring IoC container Various approaches of Bean Configuration Bean scopes Bean Lifecycle AOP with Spring Spring AspectJ integration Testing with Spring Beyond Spring Basics
Building OO systems Its all about Objects Its all about Instantiating objects Its all about communicating between the objects Its all about collaborating objects  Its all about managing objects Its all about extending objects Its all about monitoring objects
But the problem is Everything done By  Developer
What developers end up Writing to much boilerplate Coding the same patterns again Duplications Managing infrastructure Entangled interfaces Complicated Dependencies
End up spending time
You eventually end up with
S.O.L.I.D  The Single Responsibility Principle The Open Closed Principle The Liskov Substitution Principle The Interface Segregation Principle The Dependency Inversion Principle
SRP: class should have one, and only one, reason to change
OCP: extend a classes behavior, without modifying it
LSP - Derived classes must be substitutable for their base classes
ISP: Make client specific fine grained interfaces
DIP: Depend on abstractions, not on concretions
DI Approaches Pre DI Construction by hand Factory Pattern Service Locator
DI Frameworks Hollywood principle Objects are handed to you New and Factories  - Not your concern Well managed Beans First class Bean scope support No/less boilerplate  Testability dependency Injector dependency Client
Spring Framework
Spring IOC Container Instantiates Beans Assembles Beans Manages Beans Configure dependencies Injects  dependencies
Containers heirarchy
Bean Configurations XML Configuration Java Configuration Annotation-driven configuration Dynamic language configuration support ,[object Object]
Beanshell
JRuby,[object Object]
Bean scopes Singleton Prototype Request Session Global Session Supports Custom Scopes
Bean Lifecycle
Lifecycle method calls
Aspect oriented programming Originated at Xerox PARC during 95-96 under Gregorkiczales. Purposed towards OO Principles advancements for Modularization Separation of concerns Non intrusive plug-ability ,[object Object],Proxy Decorator
Proxy Pattern “provide a surrogate or placeholder for another object  to control access to it “ [GOF 94]
Manifestation of proxy Virtual proxy Remote proxy Security proxy Smart Reference proxy
Decorator Pattern “Allows new/additional behavior to be added to an existing class dynamically” [Wikipedia]
Decorator manifestation //Construct the BufferedInputStream object            bufferedInput = new BufferedInputStream(new FileInputStream(filename));
Graduate to AOP Enforce inheritance to achieve concern of separation? Specification like EJB have weird inheritance, your class never implement your interface ..huh 	Why not use POJOs and apply CCC on them thru runtime magic ?
OOP vs AOP
AOP Lingo and Jargons Aspect – The CCC that can be modularized Advice – Functionality of an Aspect (logging) Jointpoint – Opportunities in program execution to apply advice Pointcut – Exact jointpoint where advice are weaved Weaving :linking objects with other applicatin objects
Spring AOP Supports only method join points Supports only load-time weaving Advise types Before Around After –returning After–throwing After – finally
Spring @AspectJIntegration Annotation based support as of AspectJ 5.x @Aspect @Pointcut @ execution @ within @ target @annotation
AOP applications Trace aspect Performance monitoring aspect Auditing aspect Transaction managementaspect Logging aspect Security aspect Caching aspect
Testing with Spring Support for Unit and integration testing Support JUnit 3.8.x/4.x and TestNG. Readymade mocks for most JEE dependencies like JNDI, Servlet API, etc Spring TestContextFramework Supports Fixture wiring transparently Support bean caching Transaction management Extensive spring-specific support
Beyond Spring basics Spring MVC Spring DAO Spring ORN Spring JEE (JMS/JCA/JMX/Remoting) Spring Web flow Spring ROO Spring Integration Spring Security
Books
Did you get it

Contenu connexe

Tendances

SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
Samuel Breed
 
Solid and ioc principles
Solid and ioc principlesSolid and ioc principles
Solid and ioc principles
eleksdev
 
AOP in C# 2013
AOP in C# 2013AOP in C# 2013
AOP in C# 2013
Antya Dev
 

Tendances (6)

SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
Chapter1
Chapter1Chapter1
Chapter1
 
Solid and ioc principles
Solid and ioc principlesSolid and ioc principles
Solid and ioc principles
 
Refactoring Applications using SOLID Principles
Refactoring Applications using SOLID PrinciplesRefactoring Applications using SOLID Principles
Refactoring Applications using SOLID Principles
 
AOP in C# 2013
AOP in C# 2013AOP in C# 2013
AOP in C# 2013
 
Solid principles of oo design
Solid principles of oo designSolid principles of oo design
Solid principles of oo design
 

Similaire à Spring fundamentals

Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
BalamuruganV28
 

Similaire à Spring fundamentals (20)

1669609053088_oops_final.pptx
1669609053088_oops_final.pptx1669609053088_oops_final.pptx
1669609053088_oops_final.pptx
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
Object Oriented Concepts in Real Projects
Object Oriented Concepts in Real ProjectsObject Oriented Concepts in Real Projects
Object Oriented Concepts in Real Projects
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
Jump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design PatternJump start to OOP, OOAD, and Design Pattern
Jump start to OOP, OOAD, and Design Pattern
 
Jump Start To Ooad And Design Patterns
Jump Start To Ooad And Design PatternsJump Start To Ooad And Design Patterns
Jump Start To Ooad And Design Patterns
 
Design poo my_jug_en_ppt
Design poo my_jug_en_pptDesign poo my_jug_en_ppt
Design poo my_jug_en_ppt
 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns Course
 
Spring Framework
Spring FrameworkSpring Framework
Spring Framework
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC TeamAOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
Object- Relational Persistence in Smalltalk
Object- Relational Persistence in SmalltalkObject- Relational Persistence in Smalltalk
Object- Relational Persistence in Smalltalk
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 
Creativity vs Best Practices
Creativity vs Best PracticesCreativity vs Best Practices
Creativity vs Best Practices
 
Spring 2
Spring 2Spring 2
Spring 2
 
AOP
AOPAOP
AOP
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Spring fundamentals

  • 1. Spring Fundamentals Doing it right ….inversely
  • 2. Agenda Why DI and SL vs DI. Dependency injection and The Spring IoC container Various approaches of Bean Configuration Bean scopes Bean Lifecycle AOP with Spring Spring AspectJ integration Testing with Spring Beyond Spring Basics
  • 3. Building OO systems Its all about Objects Its all about Instantiating objects Its all about communicating between the objects Its all about collaborating objects Its all about managing objects Its all about extending objects Its all about monitoring objects
  • 4. But the problem is Everything done By Developer
  • 5. What developers end up Writing to much boilerplate Coding the same patterns again Duplications Managing infrastructure Entangled interfaces Complicated Dependencies
  • 8. S.O.L.I.D The Single Responsibility Principle The Open Closed Principle The Liskov Substitution Principle The Interface Segregation Principle The Dependency Inversion Principle
  • 9. SRP: class should have one, and only one, reason to change
  • 10. OCP: extend a classes behavior, without modifying it
  • 11. LSP - Derived classes must be substitutable for their base classes
  • 12. ISP: Make client specific fine grained interfaces
  • 13. DIP: Depend on abstractions, not on concretions
  • 14. DI Approaches Pre DI Construction by hand Factory Pattern Service Locator
  • 15. DI Frameworks Hollywood principle Objects are handed to you New and Factories - Not your concern Well managed Beans First class Bean scope support No/less boilerplate Testability dependency Injector dependency Client
  • 17. Spring IOC Container Instantiates Beans Assembles Beans Manages Beans Configure dependencies Injects dependencies
  • 19.
  • 21.
  • 22. Bean scopes Singleton Prototype Request Session Global Session Supports Custom Scopes
  • 25.
  • 26. Proxy Pattern “provide a surrogate or placeholder for another object to control access to it “ [GOF 94]
  • 27. Manifestation of proxy Virtual proxy Remote proxy Security proxy Smart Reference proxy
  • 28. Decorator Pattern “Allows new/additional behavior to be added to an existing class dynamically” [Wikipedia]
  • 29. Decorator manifestation //Construct the BufferedInputStream object            bufferedInput = new BufferedInputStream(new FileInputStream(filename));
  • 30. Graduate to AOP Enforce inheritance to achieve concern of separation? Specification like EJB have weird inheritance, your class never implement your interface ..huh Why not use POJOs and apply CCC on them thru runtime magic ?
  • 32. AOP Lingo and Jargons Aspect – The CCC that can be modularized Advice – Functionality of an Aspect (logging) Jointpoint – Opportunities in program execution to apply advice Pointcut – Exact jointpoint where advice are weaved Weaving :linking objects with other applicatin objects
  • 33. Spring AOP Supports only method join points Supports only load-time weaving Advise types Before Around After –returning After–throwing After – finally
  • 34. Spring @AspectJIntegration Annotation based support as of AspectJ 5.x @Aspect @Pointcut @ execution @ within @ target @annotation
  • 35. AOP applications Trace aspect Performance monitoring aspect Auditing aspect Transaction managementaspect Logging aspect Security aspect Caching aspect
  • 36. Testing with Spring Support for Unit and integration testing Support JUnit 3.8.x/4.x and TestNG. Readymade mocks for most JEE dependencies like JNDI, Servlet API, etc Spring TestContextFramework Supports Fixture wiring transparently Support bean caching Transaction management Extensive spring-specific support
  • 37. Beyond Spring basics Spring MVC Spring DAO Spring ORN Spring JEE (JMS/JCA/JMX/Remoting) Spring Web flow Spring ROO Spring Integration Spring Security
  • 38. Books