877-277-2477
info@capstonecourseware.com
117. Introduction to Spring
Version 4.1

Book cover

This course enables the experienced Java developer to use the Spring application framework to manage objects in a lightweight "IoC" (inversion-of-control) container. Spring is a far-reaching framework that aims to facilitate all sorts of Java development, including every level of multi-tier distributed systems. Here we focus on the "Core" module of the framework, developing facility in instantiating, configuring, and assembling Spring beans for various purposes.

The Core module gives the developer declarative control over object creation and assembly; this is useful for any tier of any Java application, and so this material also forms the basis for other Spring courses on persistence, web applications, and REST web services.

Prerequisites

Learning Objectives

  • Understand the scope, purpose, and architecture of Spring.
  • Use Spring application contexts to declare application components, rather than hard-coding their states and lifecycles.
  • Use dependency injection to further control object relationships from outside the Java code base.
  • Use annotations to take advantage of Spring post-processors for automated bean instantiation and wiring.
  • Configure systems of Spring beans using either Java or XML.

Timeline: 2 days.

IDE Support: Eclipse Luna

  • In addition to the primary lab files, an optional overlay is available that adds support for Eclipse Luna. Students can code, deploy, test, and debug all exercises from within the IDE. See also our orientation to Using Capstone's Eclipse Overlays.

Chapter 1. Overview of Spring

  • Java EE: The Good, The Bad, and the Ugly
  • Enter the Framework
  • Spring Value Proposition
  • The Spring Container
  • Web Applications
  • Persistence Support
  • Aspect-Oriented Programming
  • The Java EE Module(s)

Chapter 2. The Container

  • JavaBeans, Reconsidered
  • The Factory Pattern
  • Inversion of Control
  • XML View: Declaring Beans
  • Java View: Using Beans
  • Singletons and Prototypes

Chapter 3. Instantiation and Configuration

  • Configuring Through Properties
  • Configuration Namespaces
  • The p: Notation
  • Bean (Configuration) Inheritance
  • Configuring Through Constructors
  • Bean Post-Processors
  • Lifecycle Hooks
  • Integrating Existing Factory Code
  • Awareness Interfaces

Chapter 4. Dependency Injection

  • Assembling Object Graphs
  • Dependency Injection
  • Single and Multiple Relationships
  • The Utility Schema
  • Using Spring Expression Language (SpEL)
  • Inner Beans
  • Autowiring
  • @Component, @Service, & Company
  • @Autowired Properties
  • Best Practices with Spring Annotations
  • Java Classes as @Configurations
  • AnnotationConfigApplicationContext
  • Capabilities and Limitations
  • Mixing and Importing XML and Java Configurations

Chapter 5. Assembling Object Models

  • Collections and Maps
  • Support for Generics
  • The Spring Utility Schema (util:)
  • Autowiring to Multiple Beans
  • Order of Instantiation
  • Bean Factory vs. Application Context

System Requirements

Hardware Requirements (Minimum) Core i5, 1.8 GHz, 4 gig RAM, 1 gig disk space.
Hardware Requirements (Recommended) Core i5, 2.8 GHz GHz, 8 gig RAM, 1 gig disk space.
Operating System Tested on Windows 7/8, Mac OS 10.8.5.
Network and Security Limited privileges required -- please see our standard security requirements.
Software Requirements All free downloadable tools.