1 / 9

Spring framework

Spring framework. History What is Spring Framework Dependency Injection and Inversion of Control Why Spring ?. Spring History. Based on ‘Expert one-on-one J2EE Design and Development ’ by Rod Johnson Open source project since February 2003 Actual version 3.2

demi
Télécharger la présentation

Spring framework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Springframework • History • WhatisSpringFramework • DependencyInjection and InversionofControl • WhySpring ?

  2. SpringHistory • Based on ‘Expert one-on-one J2EE Design and Development’ by Rod Johnson • Open source project sinceFebruary 2003 • Actualversion 3.2 • Maincoredevelopers: • Rod Johnson • JurgenHöller

  3. WhatisSpringFramework? • IntroducingSpringisharderthanmostframeworksbecauseit’s not a single purposetechnology • Springisanopen-sourceapplicationdevelopmentframeworkproducedfor Java and .NET • Spring can bethoughtofas a hugeframeworkof best practicesforalmostevery area of Java softwaredevelopment. • Springsupportsitall and does so with some of the mostwelldesigned and heavilytested code in the Java industry • The Springframeworkhastwocorefeatures • DependencyInjection (DI) • AspectOrientedProgramming (AOP)

  4. Data Access & integration Web & remoting • Springcomponents and features JDBC ORM Web Portlet Transaction OXM JMS Servlet Struts AOP Instrumentation AOP Aspects Instrument InstrumentTomcat CoreSpring container Beans Core Context Expression Contextsupport Testing Test

  5. InversionofControl (IOC) or DependencyInjection • DependencyInjection • Beansdefinetheirdependenciesthroughconstructorarguments or properties • The container provides the injection at runtime • Decouplesobjectcreators and locatorsfromapplicationlogic • Easy tomantain end reuse • Easy testing • The IOC container is the corecomponentof the Springframework • Isresponsibleofcontaining and managingbeans • Springcomeswithtwotypesofcontainers • BeanFactory • ApplicationContext

  6. BeanFactory • Provides basic support for dependency injection • Responsiblefor • Creating and dispensingbeans • Managingdependenciesbetweenbeans • ApplicationContext • Built on top of the BeanFactory • Provides more enterprise-centricfunctionalities • Internazionalization • AOP transaction management • Mostcommonlyusedimplementationis the ClassPathXmlApplicationContext ResourcexmlFile = newClassPathResource( "META-INF/beans.xml" ); BeanFactorybeanFactory = newXmlBeanFactory( xmlFile); MyBeanmyBean = (MyBean) beanFactory.getBean( ”myBean” ); StringxmlFilePath = "META-INF/beans.xml””; ApplicationContextcontext = newClassPathXmlApplicationContext( xmlFilePath); MyBeanmyBean = (MyBean) context.getBean( ”myBean” );

  7. Bean Scopes • A beandefinitionis a recipeforcreatinginstances • Manyobjectinstances can becreatedby a single definition • Springmanagethe scope of the beansforyou • No needfordoingitprogrammatically

  8. AOP • Crosscutting concerns • Functionality whose implementation spans multiple modules • Many examples: Logging and tracing, Transaction management, security, caching, error handling, business rules, performance monitoring… • Whatis AOP? • A programming methodology to help with crosscutting concerns • Core AOP concepts: • Advice: the job of an aspect, the what and when • Join point: a point In the execution of an application where an aspect can be plugged in • Point cuts: the where of an aspect, matches one or more Join Points • Aspects: mergers of advices and poincuts

  9. WhySpring? • Itaddressesimportant areas that many other popular frameworks don't. • Spring is both comprehensive and modular • Spring is designed from the ground up to help you write code that's easy to test • Spring is an increasingly important integration technology with our existing frameworks • Great documentation and community support

More Related