1 / 8

Introduction to The Spring Framework Lightweight Enterprise Java Development

Introduction to The Spring Framework Lightweight Enterprise Java Development. Dustin Schultz dustin.schultz@utah.edu. What is the Spring Framework?. “Lightweight” Enterprise Java Development Framework Helps you with “boilerplate” code (verbose code to accomplish something small)

xena
Télécharger la présentation

Introduction to The Spring Framework Lightweight Enterprise Java Development

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. Introduction to The Spring FrameworkLightweight Enterprise Java Development Dustin Schultz dustin.schultz@utah.edu

  2. What is the Spring Framework? • “Lightweight” Enterprise Java Development Framework • Helps you with “boilerplate” code (verbose code to accomplish something small) • Dependency Injection – don’t call me, I’ll call you • Promotes loosely coupled development • A container to manage your objects

  3. Lightweight • What does lightweight mean? • Originally it referred to being lightweight as compared to Enterprise Java Beans (EJB) • Additionally, it refers to how the Spring Framework can be used in parts • spring-core – The core, Dependency Injection, etc • spring-jdbc – Java Database Connectivity Support • spring-struts – Struts Framework Support • spring-web – Web Development Support (JSP, etc) • spring-orm – Object Relational Mapping Support (Hibernate, etc) • spring-aop – Aspect Oriented Programming Support • spring-test – Unit Testing Support • spring-oxm – Marshalling/Unmarshalling Support (JAXB, etc) • spring-jms – Java Messaging Support • Many more!

  4. Boilerplate Reduction • Boilerplate code is frequent, verbose, code needed in order to accomplish something small. • Boilerplate Reduction = Simplification • JDBC is a great example of this • http://www.vaannila.com/spring/spring-jdbc-tutorial-1.html

  5. Dependency Injection 1 (DI) • Enterprise development involves a lot of dependencies • This was originally one of Spring’s large selling points but Spring is now so much more. • Hollywood Principle – Don’t call me, I’ll call you • A form of Inversion of Control (IoC) • You give up control of instantiation/lookup to Spring

  6. Dependency Injection 2 (DI) • Instead of “calling me” Object foo =FooFactory.getFoo(); • “I’ll call you” privateObject foo; publicvoidsetFoo(Object foo){ this.foo= foo; }

  7. Container - ApplicationContext • ApplicationContextis a Object or “Bean” factory on steroids. • Instantiates your beans and adds additional functionality like post processors • Spring manages your objects • From instantiation to destruction • You hardly ever use the ‘new’ keyword anymore • “Singleton” • Lazy initialization

  8. Coding Walkthrough • Goal: build a simple application that says hello in several languages utilizing Spring • If you use git: git clone git://git.bmi.utah.edu/swe-series/spring-intro.git • http://git.bmi.utah.edu/swe-series/spring-intro/archive-tarball/master

More Related