spring framework lunch and learn presentation

9
Spring Framework Lunch and Learn Tom Henricksen and Ben Alibasic

Upload: tom-henricksen

Post on 13-Jan-2015

190 views

Category:

Technology


4 download

DESCRIPTION

Spring Framework Lunch and Learn Presentation. This content is partially based on the Spring in Action book from Craig Walls second edition.

TRANSCRIPT

Page 1: Spring Framework Lunch and Learn Presentation

Spring Framework Lunch and Learn

Tom Henricksen and Ben Alibasic

Page 2: Spring Framework Lunch and Learn Presentation

Spring and Dependency Injection

● Spring is an open source framework, created by Rod Johnson and described in his book Expert One-on-One: J2EE Design and Development

● Dependency injection-Spring promotes loose coupling through a technique known as dependency injection(DI)

Page 3: Spring Framework Lunch and Learn Presentation

Spring and Dependency Injection

● Coupling is a two-headed beast. On one hand, tightly coupled code is difficult to test, difficult to reuse, difficult to understand, and typically exhibits "whack-a-mole" bugs.

Page 4: Spring Framework Lunch and Learn Presentation

Spring Basics

● Any Java Application can benefit from Spring in terms of simplicity, test-ability, and loose coupling.

● What's more, Spring is non intrusive: objects in a Spring-enabled application often have no dependencies on Spring-specific classes.

Page 5: Spring Framework Lunch and Learn Presentation

Spring Basics

● At the core of Spring Framework is the Spring container.

● Spring's core container provides the fundamental functionality of the Spring Framework. BeanFactory

● In Spring, there are many ways to wire components together, but the most common approach is via XMLs.

Page 6: Spring Framework Lunch and Learn Presentation

Basic Bean Writing

● The act of creating these associations between application objects is the essence of dependency injection (DI) and is commonly referred to as wiring.

● Containing your beans● In Spring-based application, your application

objects will live within the Spring container.

Page 7: Spring Framework Lunch and Learn Presentation

Basic Bean Writing

● The container is at the core of the Spring Framework. Spring's container uses dependency injection (DI) to manage the components that make up an application.

● Two types of Spring containers● Bean factories● Application contexts

Page 8: Spring Framework Lunch and Learn Presentation

Introducing the BeanFactory

● Bean factory is an implementation of the Factory design pattern. That is, it is a class whose responsibility is to create and dispense beans.

● Bean factory is a general-purpose factory, creating and dispensing many types of beans.

Page 9: Spring Framework Lunch and Learn Presentation

Introducing the BeanFactory

● Beans are "lazily loaded" into bean factories, meaning that while the bean factory will immediately load the bean definitions (the description of beans and their properties), the beans themselves will not be instantiated until they are needed.