Spring Boot Apps with Kotlin

This training provides all elements of developing applications with the Spring framework family. Participants will be able to use the Spring Initializr to build and create projects, use Dependency Injection and AOP to compose component trees, leverage MVC and WebFlux to write RESTful services, and use Spring Data to access databases by the end of the delivery. After this course, participants will be able to use Actuator to add metrics and Spring Security for rudimentary authentication.

This course is designed to teach you how to code in Kotlin, with a focus on using Kotlin to create full-stack Spring Boot apps.


What You’ll Learn

➜ How to create fully operational and functional applications.

➜ How to write RESTful services in Kotlin with Spring Boot, WebFlux, MVC

➜ How to provide security to Spring Boot 

➜ The Spring Boot Starter Test

➜ Dependency Injection in Spring Core

 Advanced Configuration of Spring Controllers

 Database Access with Spring Data

➜ We recommend that attendees of this course are comfortable with Kotlin.

➜ Basic knowledge of the architecture of RESTful services and Single Page Applications is recommended.


Course Outline

Introduction to Spring

  • Weaknesses in the original JEE architecture
  • Advantages of Spring arose as a cure for the maladies of JEE
  • Configuring Spring via XML, YAML, Groovy and Kotlin
  • How to choose between the configuration options
  • Springs growth from library to framework to ecosystem
  • Choosing between the Spring platform and JEE8
Annotation Based Dependency Injection in Spring Core
  • The role of the ApplicationContext in Spring DI
  • Different ways of providing bean wiring to the context object
  • Understanding scopes and selecting the correct scope for a bean
  • Applying Autowired to perform autowiring by type
  • Applying Autowired and Qualifier for autowiring by name
  • Applying Resource as an alternative means of autowiring by name
  • Declaring beans using Component, Service and Controller
  • Building bean provider methods via Configuration classes
  • A thorough overview of Spring Expression Language (Spring EL)
  • Populating fields via Spring EL using Value
Other Forms of Dependency Injection in Spring Core
  • The XML based Bean Description Language and Schema Extensions
  • The Groovy and Kotlin based Domain Specific Languages
  • Support for standard properties files and YAML
Unit Testing Spring Beans
  • How a DI container aids unit and integration testing
  • Configuring the Spring specific test runner for JUnit
  • Injecting dependencies into JUnit tests via Spring
  • Creating configurations for different testing scenarios
  • Combining mocking frameworks like Mockito with Spring
Introduction to Aspect Oriented Development
  • Cross-cutting concerns (Aspects)
  • Key terms such as Aspects, Advice, Pointcuts, Weaving…
  • A thorough guide to AspectJ Pointcut Expressions
  • Support for AOP in Spring Core via auto-proxying
  • Understanding why only method calls can be intercepted in Spring
  • Declaring Advice and Pointcuts using annotations
  • The five different kinds of advice
  • Understanding how AOP is used within Spring Security and Transactions
Introducing Spring Boot
  • The need for a meta-framework to manage Spring itself
  • Building Spring Boot projects via the ‘Spring Initializr’
  • How Spring Boot configures other parts of Spring as modules
  • Customizing the Maven / Gradle build file to manage dependencies
  • Options for overriding the default configurations in Spring Boot
  • Building and testing command line applications in Spring Boot
Using Spring MVC within Spring Boot
  • How MVC evolved from a Web Framework to a Microservices Platform
  • MVC Design (Dispatcher Servlet, Handler Mappings and View Resolvers)
  • Registering controllers via annotations and component scanning
  • The difference between @Controller and @RestController
  • Deploying MVC Apps as Microservices via Spring Boot and Cloud Services
  • Overriding the default configurations and registering JEE components
Basic Configuration of Spring Controllers
  • Associating controller beans with URL patterns
  • Mapping methods to HTTP verbs (GET, POST, PUT etc…)
  • Methods for triggering depending on parameters and headers
  • Objects from the Servlet API are sent into methods.
  • Individual parameter injection and JavaBean filling
  • Information injection from HTTP headers and cookies
  • Using path variables to inject information from the URL
  • Marshalling the body of the request into JSON and/or XML
  • Modifying XML marshalling via the JAXB annotations
  • Modifying JSON marshalling via Jackson annotations
Advanced Configuration of Spring Controllers
  • Wrapping the response type in ResponseEntity
  • Creating ResponseEntity objects via the builder API
  • Customizing the response code and manipulating HTTP headers
  • Validating input via the JSR-303 Bean Validation annotations
  • Registering your own validators for cross-field validations
  • Using the Optional type for request routing
  • Defining model attributes and exception handler methods
  • Redirecting output to server pages via view resolvers
  • Configuring Thymeleaf as a sample server page library
Writing Tests and Clients for Spring Controllers
  • The spring-test module and TestContext framework
  • Creating a Web Application Context within a JUnit test
  • Sending requests to controllers via the Dispatcher Servlet
  • Using the fluent API to specify requests and check responses
  • Writing clients for RESTful Services via the JAX-RS Client API
  • Writing clients for RESTful Services via the Spring RestTemplate
Enhancements in Spring 5 and Spring Boot 2
  • Support for Functional and Reactive Programming in Spring 5
  • The new ‘WebFlux’ model for services in Spring Boot 2
  • Building WebFlux based services via MVC annotations
  • Creating WebFlux services fia the functional model
  • Leveraging the Kotlin based DSL for functional services
How to Secure and Monitor Spring Microservices
  • Combining Spring Security with Spring Boot Applications
  • Different options for adding authentication to endpoints
  • Using Spring Actuator to collect metrics from running services
  • Customizing and extending the built in metrics and health checks
Database Access with Spring Data
  • The ‘Object Relational Mismatch’
  • ORM frameworks (Hibernate and the JPA)
  • Simplifying the creation of repositories with Spring Data
  • How to customize and extend your repository components