Objectives

  Upon completion of this course, you should be able to:
  • Understand the new features of the Spring 3.0 framework
  • Define Spring components and perform dependency injection using Java annotations 
  • Define automated tests for Spring components
  • Integrate Spring with the Hibernate and JPA ORM frameworks
  • Understand how to use Spring with the Java standard JSF web application framework
  • Use the Spring MVC web framework to develop flexible web applications
  • Define Spring REST services
  • Understand the uses of Spring Security
  • Use Spring Web Flow to create conversational web applications  
 

Topics

 
  • New features of Spring 3.0
  • Advanced ways to define Spring components with annotations
  • Performing dependency injection with annotations (including the JSR-330 Java standard for dependency injection)
  • Spring testing
  • Database Integration with JPA and Hibernate
  • Using Spring with JSF
  • Spring MVC
  • Spring REST services
  • Spring Security
  • Spring Web Flow  

Audience

 

Software designers, developers and programmers.

Prerequisites

 

To succeed fully in this course, students should:

  • Be able to program Java applications - Course WA1278 meets this requirement
  • Have some prior experience with the Spring Framework (versions 2.0 or 2.5)

 

Duration

  Three days.

Outline for Spring 3 Migration and New Features

Chapter 1. Review of New Features in Spring 3.0

  • Requirements and Supported Environments
  • Using Spring with Servers
  • Packaging
  • Spring Expression Language
  • Java-based Configuration
  • Annotation-based Configuration
  • Spring MVC Changes
  • New Spring MVC Configuration
  • Spring MVC Annotation Example
  • Validation
  • Summary

Chapter 2. Advanced Spring Bean Configuration

  • Defining Beans with Annotations
  • Component Stereotype Annotations
  • Spring Component Annotations
  • Bean Scope with Annotations
  • Configuring Classpath Scanning for Spring Beans
  • Choosing Which Annotations to Use
  • Overriding Annotation Configuration with XML
  • Externalizing Bean Configuration
  • PropertyPlaceholderConfigurer
  • PropertyOverrideConfigurer
  • Inheriting Bean Configuration
  • Lazy Initialization
  • Declaring Beans from Static Fields
  • Declaring Beans from Object Properties
  • Summary

Chapter 3. Spring Dependency Injection with Annotations

  • Dependency Injection Annotations
  • @Autowired and @Inject
  • Locations for @Autowired and @Inject
  • Autowiring Multivalued Properties
  • Autowiring by Bean Name with @Resource
  • Injecting Named Collections Defined in XML with @Resource
  • Checking Required Dependencies
  • Enforcing Required Properties with XML Autowiring
  • Multiple @Autowired Constructors
  • Multiple Autowiring Matches
  • Qualifiers with Annotation-based Autowiring
  • Adding a Qualifier Value to a Bean Definition
  • Qualification of Multivalued Properties
  • Defining Custom @Qualifier Annotations
  • Complex Custom @Qualifier Annotations
  • Associating Custom Bean Qualifiers with XML
  • Processing Injection Annotations
  • Overriding Annotation Injection
  • Summary

Chapter 4. Alternate Configuration

  • Java @Configuration Classes
  • Configuration with Spring Expression Language
  • Resolving Text Messages
  • Loading External Resources
  • Spring Property Editors
  • Custom Property Editors
  • Summary

Chapter 5. Testing Spring Applications

  • Spring Unit Testing
  • Configuring Test Projects
  • Spring TestContext Framework
  • Implementing Test Classes
  • Loading Spring Configuration with Test Classes
  • Accessing Spring Components Within Test Classes
  • Defining Tests to Execute
  • Isolating Tests Which Modify the Spring Environment
  • Transactional Testing Support
  • Transactional Test Base Classes
  • Avoiding False Positives with ORM Testing
  • Other Transaction Annotations
  • Other Spring Annotations for JUnit
  • Unit Testing Support Classes
  • Mock Objects
  • Summary

Chapter 6. Overview of Spring Database Integration

  • DAO Support in Spring
  • DataAccessException
  • Using DataSources
  • DAO Templates
  • DAO Templates and Callbacks
  • ORM Tool Support in Spring
  • Summary

Chapter 7. Using Spring with JPA or Hibernate

  • Spring ORM
  • Benefits of Using Spring with ORM
  • Spring @Repository
  • Using JPA with Spring
  • Configure Spring JPA EntityManagerFactory
  • Using JNDI to Lookup JPA EntityManagerFactory
  • LocalContainerEntityManagerFactoryBean
  • LocalEntityManagerFactoryBean
  • Application JPA Code
  • Hibernate
  • Hibernate Session Factory
  • Spring LocalSessionFactoryBean
  • Application Hibernate Code
  • "Classic" Spring ORM Usage
  • Spring JpaTemplate
  • Spring JpaCallback
  • JpaTemplate Convenience Features
  • Spring HibernateTemplate
  • Spring HibernateCallback
  • HibernateTemplate Convenience Methods
  • Summary

Chapter 8. Using JSF with Spring

  • JSF Integration Options
  • DelegatingVariableResolver
  • SpringBeanVariableResolver
  • SpringBeanFacesELResolver
  • Spring Bean Scopes
  • FacesContextUtils
  • JSF with Spring Web Flow

Chapter 9. Spring MVC

  • Spring MVC
  • Spring MVC Components
  • DispatcherServlet
  • Context Loaders
  • Spring MVC Example
  • Mapping Web Requests
  • BeanNameUrlHandlerMapping
  • CommonsPathMapHandlerMapping
  • Using Multiple Handler Mappings
  • Controller Hierarchy
  • AbstractCommandController
  • SimpleFormController
  • AbstractWizardFormController
  • MultiActionController
  • ThrowawayController
  • View Resolution
  • InternalResourceViewResolver
  • BeanNameViewResolver
  • XmlViewResolver
  • ResourceBundleViewResolver
  • Using Multiple View Resolvers
  • Binding Views to Models
  • Spring Form Tags
  • form and input Tags
  • password and hidden Tags
  • checkbox Tag
  • radiobutton Tag
  • textarea Tag
  • select Tag
  • option Tag
  • options Tag
  • errors Tag

Chapter 10. Spring REST Services

  • Many Flavors of Services
  • Understanding REST
  • RESTful Services
  • REST Resource Examples
  • REST vs SOAP
  • Relation to Spring MVC
  • Adding REST Capability to Existing Spring MVC Applications
  • RestTemplate
  • HTTP Message Conversion
  • Summary

Chapter 11. Spring Security

  • Securing Web Applications with Spring Security 3.0
  • Spring Security 3.0
  • Authentication and Authorization
  • Programmatic v Declarative Security
  • Getting Spring Security from Maven
  • Spring Security Configuration
  • Spring Security Settings in Spring Configuration
  • Basic Web Security Configuration
  • Granting Anonymous Access to Pages and Resources
  • Requiring Encrypted HTTPS Communication
  • Customizing Form-based Login
  • Custom Login Page
  • Configure Logout
  • Session Management
  • Selectively Display Links in a JSP
  • Method Level Security
  • Authentication Manager
  • Using Database User Authentication
  • LDAP Authentication
  • Encoding Passwords
  • Using an External Authentication Provider
  • Summary

Chapter 12. Introduction to Spring Web Flow 2

  • What is Spring Web Flow 2?
  • Relationship to Spring and Spring MVC
  • Spring Web Flow 2 Modules
  • Integration Support
  • What is a Flow?
  • Book Hotel Flow Example
  • Book Hotel Flow Definition
  • Benefits of Spring Web Flow 2
  • Required Software
  • Configuration Steps
  • JAR File Instructions
  • Configure web.xml
  • Spring Web Flow Components
  • Sample Spring Web Flow Configuration File
  • Summary