Spring Framework Immersion

Duration: 5 days

This in-depth, advanced workshop using Spring will present developers with best practices for software development, as well as tips and techniques for working with the tools and technologies within their specific environment

During the course you will get to know Core Spring, Spring Testing, Spring JDBC, Spring Integration with Hibernate/JPA, Spring RESTful services with Spring MVC and an introduction to Spring Boot. The course uses gradle for the build system.

Note: we recently rewrote this longstanding and popular course from scratch to bring you an updated contemporary new version.

To get the greatest benefit from this course you should be an experienced Java Developer.

Please find the course objectives below:

Here's what we'll be covering through this course:

Core Spring

Introduction

  • Introduction to Spring
  • Spring in a historical context
  • Introduction to dependency injection and inversion of control (IOC)
  • Overview of Spring modules
  • Setting up Spring projects with Gradle (also maven and sbt)

Inversion of Control

  • Spring configuration using (namespace driven) XML
  • Java based Spring configuration (@Configuration)
  • Understanding the Application Context and related interfaces
  • Initialising an application
  • Defining and configuring beans in XML
  • Life-cycle callbacks (init, destroy)
  • Defining bean creation (constructor params, factory methods)
  • Understand bean scopes
  • Property and constructor injection
  • Injecting beans
  • Injecting values
  • Defining lists, maps, properties,… in the spring configuration
  • Auto-wiring by type and by name
  • Bean configuration inheritance
  • Overview spring namespaces for XML configuration
  • The util namespace
  • Externalising configuration with property files using Property Placeholders
  • Using Profiles

Annotation-driven

  • Enabling and using annotation driven configuration
  • Overview of Spring, JSR250 and JSR330 annotations
  • Dependency inject by type (@Autowired/@Inject) and by value (@Resource)
  • Using the @Primary annotation
  • Using Spring Qualifiers
  • Using JSR330 Qualifiers
  • Component scanning
  • Using stereotype annotations
  • Using other techniques for scanning (regex, …)
  • Fine tuning scanning
  • Using Profiles

Java configuration

  • Using @Configuration and @Bean
  • Configure beans (names, Life-cycle methods, scope)
  • bean references in the configuration
  • Injecting beans into the configuration
  • Enabling component scanning
  • Using @Import
  • Obtaining the AnnotationConfigApplicationContext

I18 and and more

  • Using Factory Beans
  • Registering Component Editors
  • Internationalisation

Spring Test Framework

Here we merely introduce te Spring Test Framework. Concepts such as database integration tests, transactional tests, mocks, testing web mvc application are explained in their respective session.

  • Introduction to Spring Testing
  • Using it with junit
  • Loading the context configuration using @ContextConfiguration
  • Using Dependency Injection for your test fixture
  • Using profiles during testing
  • Use other spring test annotations (@Timed, @Repeat, @DirtiesContext)

Spring data access

Introduction

  • Understand the module's architecture
  • Understand its features
  • Define Datasources (JNDI, DBCP, C3P0, HikariCP)
  • Introduce repository classes
  • Introduction to template classes
  • Using DaoSupport
  • Understand Spring's consistent exception translation for repositories
  • Managing Transactions
  • Programmatic and Declarative transaction management
  • List various platform transaction managers (DataSource, Jta, Jpa, …)
  • Understand the seven transaction attributes
  • Setting transaction isolation levels
  • Managing transaction time-outs
  • Using Spring Test for database integration tests
  • Executing sql scripts using @Sql during testing

JDBC

  • Using templates (JdbcTemplate/NamedParameterJdbcTemplate)
  • query and update the database using templates
  • Using different parameters sources
  • Use different result mapping techniques
  • Query for single results
  • Query for *multiple** results
  • Working with generated keys
  • Working with exceptions
  • Using jdbc classes such as SimpleJdbcInsert
  • Introduce RDBMS Objects such as SqlUpdate

ORM

  • Introduce Spring's Hibernate and JPA suport
  • Configuring Hibernate's SessionFactory
  • Configuring the transaction manager for Hibernate
  • Using the SessionFactory in your repositories
  • List various ways to manage JPA's entity managers
  • Using the LocalContainerEntityManagerFactoryBean
  • Configuring transactions for JPA

Introduction to Spring Boot

  • Introduce idea and architecture behind SpringBoot
  • Discuss various starters (Spring Initializr)
  • Setting up a gradle project for spring boot
  • Use the spring boot cli (command line interface)
  • Configure a SpringBoot application
  • Using yaml configuration for datasources
  • Configure for logging
  • List other key configuration properties
  • Setting up your own properties
  • Bootstrap the SpringBoot application

Spring MVC

Introduction

  • Introduce the Spring MVC architecture
  • Discuss Spring MVC's features
  • Introduce the DispatchServlet
  • Configure Spring MVC using Java configuration (Servlet Environment)
  • Configure Spring MVC inside a Spring Boot application
  • Introduce controllers and RequestMapping
  • Map URIs and HTTP methods
  • Handle request parameters
  • Handle http headers
  • List the possible return types of handler methods
  • Overview of Handling exceptions
  • Using the @ControllerAdvice

Testing

  • Introduction to Testing Spring MVC Applications
  • Mocking Spring MVC
  • Understand how to use the RequestBuilder
  • Supply parameters, mime-types, headers, cookies, …
  • Setup expectations with ResultMatcher
  • Using jsonPath to state expectations on returned json data

Rest with Spring

Introduction

  • Overview of Rest with Spring
  • Creating ResultController implementations
  • More on URL Patterns mapping (path variables, regex)
  • Handle mime-types
  • Using HttpEntity in handler methods
  • Validating data using jsr303

Jackson

  • Introduction to Jackson
  • Mapping pojos to json/xml/protobuf etc.
  • Use Jackson annotations
  • Mapping null, Optional.none, and empty strings values
  • Introduce Jacksons Views
  • Discuss various plugins for data types (most notably jdk8 and jsr310)
  • Same for data formats (xml, protobuf, avro, …)
  • Configuring Jackson with Spring
  • Configure Spring's content negotiation

As you can see from the above course description, this is a densely layered course that has been balanced to give developers valuable insight and the knowledge necessary for Spring.

For an onsite course please contact us