• Save
Spring fundamentals
Upcoming SlideShare
Loading in...5
×
 

Spring fundamentals

on

  • 2,935 views

 

Statistics

Views

Total Views
2,935
Views on SlideShare
2,906
Embed Views
29

Actions

Likes
3
Downloads
0
Comments
0

3 Embeds 29

http://collegelabs.co 16
http://www.collegelabs.co 8
http://www.slideshare.net 5

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Spring fundamentals Spring fundamentals Presentation Transcript

  • 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
    • Groovy
    • Beanshell
    • JRuby
  • Injecting dependencies
    Supports Constructor,Method and Setter Injection
    Intra-Bean dependencies bootstrapping
    Autowire : byName, byType, Constructor, Autodetect
    Ensure type safety
    First class support
    Primitives
    Strings
    Collections : <list/>, <set/>, <map/>, and <props/>
    Nulls : <null/>
  • 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
    • Structural Patterns
    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