Spring Fundamentals<br />Doing it right ….inversely<br />
Agenda<br />Why DI and SL vs DI.<br />Dependency injection and The Spring IoC container<br />Various approaches of Bean Co...
Building OO systems<br />Its all about Objects<br />Its all about Instantiating objects<br />Its all about communicating b...
But the problem is<br />Everything<br />done<br />By <br />Developer<br />
What developers end up<br />Writing to much boilerplate<br />Coding the same patterns again<br />Duplications<br />Managin...
End up spending time <br />
You eventually end up with<br />
S.O.L.I.D <br />The Single Responsibility Principle<br />The Open Closed Principle<br />The Liskov Substitution Principle<...
SRP: class should have one, and only one, reason to change<br />
OCP: extend a classes behavior, without modifying it<br />
LSP - Derived classes must be substitutable for their base classes<br />
ISP: Make client specific fine grained interfaces<br />
DIP: Depend on abstractions, not on concretions<br />
DI Approaches<br />Pre DI<br />Construction by hand<br />Factory Pattern<br />Service Locator<br />
DI Frameworks<br />Hollywood principle<br />Objects are handed to you<br />New and Factories  - Not your concern<br />Well...
Spring Framework	<br />
Spring IOC Container<br />Instantiates Beans<br />Assembles Beans<br />Manages Beans<br />Configure dependencies<br />Inje...
Containers heirarchy<br />
Bean Configurations<br />XML Configuration<br />Java Configuration<br />Annotation-driven configuration<br />Dynamic langu...
Beanshell
JRuby</li></li></ul><li>Injecting dependencies<br />Supports Constructor,Method and Setter Injection<br />Intra-Bean depen...
Bean scopes<br />Singleton<br />Prototype<br />Request<br />Session<br />Global Session<br />Supports Custom Scopes <br />
Bean Lifecycle<br />
Lifecycle method calls<br />
Aspect oriented programming<br />Originated at Xerox PARC during 95-96 under Gregorkiczales.<br />Purposed towards OO Prin...
Proxy Pattern<br />“provide a surrogate or placeholder for another object  to control access to it “ [GOF 94]<br />
Manifestation of proxy<br />Virtual proxy<br />Remote proxy<br />Security proxy<br />Smart Reference proxy<br />
Decorator Pattern<br />“Allows new/additional behavior to be added to an existing class dynamically” [Wikipedia]<br />
Decorator manifestation<br />//Construct the BufferedInputStream object            bufferedInput = new BufferedInputStream...
Graduate to AOP<br />Enforce inheritance to achieve concern of separation?<br />Specification like EJB have weird inherita...
OOP vs AOP<br />
AOP Lingo and Jargons<br />Aspect – The CCC that can be modularized<br />Advice – Functionality of an Aspect (logging)<br ...
Spring AOP<br />Supports only method join points<br />Supports only load-time weaving<br />Advise types<br />Before<br />A...
Spring @AspectJIntegration<br />Annotation based support as of AspectJ 5.x<br />@Aspect<br />@Pointcut<br />@ execution<br...
AOP applications<br />Trace aspect<br />Performance monitoring aspect<br />Auditing aspect<br />Transaction managementaspe...
Testing with Spring<br />Support for Unit and integration testing<br />Support JUnit 3.8.x/4.x and TestNG.<br />Readymade ...
Beyond Spring basics<br />Spring MVC<br />Spring DAO<br />Spring ORN<br />Spring JEE (JMS/JCA/JMX/Remoting)<br />Spring We...
Books<br />
Did you get it<br />
Upcoming SlideShare
Loading in …5
×

Spring fundamentals

3,063 views

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,063
On SlideShare
0
From Embeds
0
Number of Embeds
47
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Spring fundamentals

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

×