Your SlideShare is downloading. ×
Story ofcorespring infodeck
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Story ofcorespring infodeck


Published on

  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Whats the Problem we are trying to solve
  • TATA NANO has Engine on the Back when the person sits -- TODO Add the Trunk Image
  • Spring DI which allows ot inject dependencies, so your code base is made only of interface and does not know about implementations Spring AOP is the declarative aspect which allows to add a nature to a class, like Translcation, logging Portal Service Abstracts + Good Documentation
  • Transcript

    • 1. Store Of Core Spring Mak Bhatamrekar AJCP Java Concept Pros
    • 2. Agenda• The Problem• Solution With No Spring and Challenges• Magic Of Spring Core/ DI• More on XML Config & Co`ncepts• Must Know Key Concepts• Whats new Spring 3• Recap
    • 3. Dependencies 
    • 4. TATA NANO
    • 5. IssuesMultiple Programmers Practical Aspects• Create Dummy Classes ? Different Test and – Method Names e.g getType() Production Configurations in engine• Code and Compile ?Reduced Test Cycles – Add image here ?Cluttered Business Logic
    • 6. Spring Framework – The Hero Important Dates • Spring 1.0 - 2004 • Spring 1.2.6 – Won Awards • Spring 2.0 – Oct 2006 • Spring 2.5 – Nov 2007 • Spring 3.0 – Dec 2009 • Spring 3.1 – Dec 2011 • Spring 3.2.1 – Jan 2013 • Spring 4.0 – End of Year
    • 7. Spring FrameworkJosh long-a-walking-tour-of-spring-3-1-pdf-d421509802 -
    • 8. Spring Projects• Spring Security• Spring Integration• Spring Batch• Spring Data• Spring Web Services• Spring Web• Spring Social• Spring Android• More..
    • 9. DriverMain
    • 10. Dependency Injection is a form of Inversion OfControl.Also know as the Hollywood Principle “Don’t call us, we’ll call you! “
    • 11. DI Types• XML Based• Annotation Based – Bypass some of the XML Configurations with XML Support.• Java Based
    • 12. <bean id="car" class="com.ajcp.withspring.v1.testimpl.Car"><!-- setter Injection example --><constructor-arg ref="tireList" /><bean id="engine" class="com.ajcp.withspring.v1.testimpl.Engine"><constructor-arg ref="engine" /><property name="type" value="V4"></property></bean></bean>
    • 13. Important Configs• <context:annotation-config />• <context:component-scan>• p: -- namespace for setter injections• c: -- namespace for getter injects• util: -- useful utilties for DI• aop – aop support• tx – transaction support
    • 14. At it’s core – Spring is a framework for wiring upyour entire application
    • 15. @Autowired• byName - by property name• byType - by property type• Constructor – Similar to byType but applies to constructor args• Autodetect – first autowires by constructor, if that fails autowires byType.
    • 16. <context:annotation-config /> <context:component-scan base- package="com.ajcp.withspring.v2annotation.testimpl" /> <bean id="brand" class="com.ajcp.withspring.v2annotation.testimpl.Bran d"/><!– Autowire byType --><bean id="tire1"class="com.ajcp.withspring.v2annotation.testimpl.TireImpl" autowire="byType"></bean> <!– Autowire constructor--> <bean id="carService" class="com.ajcp.withspring.v2annotation.testimpl.CarImpl" autowire="constructor">
    • 17. Spring DI Annotations• @Required• @Autowired• @Qualifier• @Resource – JSR Annotation – – Combines @Autowired and @Qualifier• @Component• @Service• @Repository
    • 18. @Autowired // beans are autowired by Typeprivate EngineService engineService;@Autowired@Qualifier("tire1")private TireService tireService;
    • 19. public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("BeansWit Annotation.xml");@Bean Driver driver = (Driver) @Scope("prototype") context.getBean("driver"); public EngineService engineService(){ driver.createCarAndDrive(); EngineService e = new EngineImpl(); e.setType(EngineImpl.V6_ENGINE); return e; } Java Based Config
    • 20. Bean Scopes• Singleton (default)• Prototype• Request• Session• Global session
    • 21. Steps To Execute SourceCode1. Download from github, Zip option is also there2. cd SpringCoreCarSample3. mvn compile eclipse:eclipse4. Open Eclipse5. Select File ->Import -> Existing Projects Into..6. Run the Main classes as Application from Eclipse
    • 22. Reference / Atlanta Spring Users Group••••
    • 23. Store Of Core Spring Mak Bhatamrekar github : twitter : mak-bkar url : www.careerinjava.com Java Concept Pros