Build Spring Boot Apps with the Kotlin Programming Language

Build Spring Boot Apps with the Kotlin Programming Language

7h 48mIntermediate2019-01-30

Authors

Matt Greencroft

Matt Greencroft

Matt Greencroft is a full-time trainer and software development consultant.

Course details

Kotlin is an exciting programming language that's concise, has immutable variables, and almost always gets rid of null pointer exceptions. If you're a Java developer looking to get started with Kotlin, then this course is for you. Join instructor Matt Greencroft as he demonstrates how to build high-quality Spring Boot applications with Kotlin, specifically the version of Kotlin that runs on the Java Virtual Machine (JVM). As Matt covers a range of key concepts—from classes to loops—he explains how each Kotlin feature compares to the equivalent one in Java.

Learning objectives
Creating a new Kotlin project
Working with strings
Data types in Kotlin
Creating and calling top-level functions
Creating classes
Collections
Throwing exceptions
Class inheritance
Java interoperability
Functional programming
Using JUnit with Kotlin

Skills covered

Spring BootKotlinMobile Device ManagementWeb Development ToolsFull-Stack Web DevelopmentWeb DevelopmentProgramming LanguagesNetwork and System AdministrationOpen SourceSoftware DevelopmentOne-Off

Concepts

Introduction

  • Introduction
  • What is Kotlin
  • Installing IntelliJ
  • Configuring IntelliJ

Working with Strings

  • Creating a new Kotlin project
  • Variable declaration syntax
  • Inferring variable types and println
  • Using string templates
  • Multiple line strings

Other Variable Types

  • Using the Double type and determining class types
  • The Int data type
  • Other data types
  • Casting in Java
  • Casting in Kotlin
  • Chapter review

Nullable Variables

  • Creating variables that can contain a null value
  • Methods that work with nullable parameters
  • The null-safe and non-null asserted operators
  • The Nothing object type

Functions

  • The function syntax and the Unit object
  • Creating and calling top-level functions
  • Single expression functions
  • Using named parameters and optional parameters
  • Other aspects of functions in Kotlin

Classes

  • Project structure and packages
  • The class declaration and class-level attributes
  • Instantiating a class and accessing class-level attributes
  • Creating a simple constructor
  • Secondary constructors
  • Alternative class design
  • Overriding getters and setters
  • Functions within a class
  • Static functions
  • Data classes

Practical Exercise 1

  • Explaining the challenge
  • Solution walk-through

If and Object Equality

  • The if keyword as an expression
  • Using if to do a null-safe check
  • The let function
  • Object equality and the when expression

Ranges and Looping

  • The while loop
  • Using for to loop through a collection
  • Destructuring with a for loop
  • Looping with a range

Collections

  • Mutable collections with immutable variables
  • Immutable lists
  • Mutable lists
  • Maps and sets
  • Working with arrays

Practical Exercise 2

  • Explaining the challenge
  • Solution walk-through

Exceptions and the try-catch Block

  • Exceptions are unchecked
  • Throwing exceptions
  • try as an expression
  • use as an expression (try with resources)

Testing

  • Using JUnit with Kotlin
  • The Kotlin test assertions
  • Testing for exceptions

Polymorphism and Inheritance

  • Creating and implementing interfaces
  • Class inheritance
  • Creating custom exceptions
  • Extension functions

Java Interoperability

  • Instantiating classes and providing values to non-nullable variables
  • Using data classes
  • Using immutable lists
  • Exception handling
  • Using static functions
  • Importing a Kotlin JAR file into a Java project

Getting Started with Spring Boot

  • Creating a project with the Spring Initializr
  • A hello world controller
  • Auto-restarting an application
  • Overview of the case study
  • Creating views and backing beans
  • Connecting views to controller functions
  • Adding services
  • Posting to a controller
  • Dependency injection
  • Revisiting backing beans

Functional Programming

  • Functional programming overview
  • Methods that take function parameters the Java way
  • Methods that take function parameters the Kotlin way
  • Functional programming with lists
  • filter and flatMap
  • reduce and fold
  • Working with maps

Getting Started with Hibernate

  • Adding the Hibernate dependencies
  • The challenge of creating entities
  • Persisting data to a database

Practical Exercise 3

  • Step 1 - Explaining the challenge
  • Solution walk-through
  • Mappings between entities
  • Upgrading the view
  • Step 2 - Explaining the challenge
  • Solution walk-through
  • Step 3 - Explaining the challenge
  • Solution walk-through

Reflection

  • The concept of reflection
  • Inspecting properties and functions
  • A practical use for reflection
  • Thank you and goodbye
120,000 Toman