O'Reilly logo
live online training icon Live Online training

Kotlin + Spring Boot Essentials

Build Spring applications using Kotlin

Topic: Software Development
Ken Kousen

Kotlin—a JVM-based language that features null safety at the compiler level—is optimized for both performance and safety. Kotlin also makes interoperability with existing Java libraries very easy. Spring 5 and Spring Boot 2 brought special support for Kotlin to the Spring framework, providing Kotlin extension functions and domain-specific languages that significantly simplify application development and testing. Anything previously written in Java can now be written in Kotlin, with all the same Spring features and benefits.

Join expert Ken Kousen to learn how to create, deploy, and maintain applications and web services written in Spring using the Kotlin programming language. By the time you’re through, you’ll understand how to take advantage of modern development practices using Kotlin in your Spring applications.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • How null-safe capabilities in Kotlin eliminate entire classes of potential errors
  • How to take advantage of Kotlin capabilities in Spring
  • Spring development, from basic web applications to RESTful web services

And you’ll be able to:

  • Build and configure Spring applications written in Kotlin
  • Test and deploy both web apps and RESTful web services
  • Use Kotlin annotations and extension functions to simplify Spring configuration

This training course is for you because...

  • You’re a Java developer who wants to write Spring applications.
  • You’re a team member or leader who needs to build and support applications using the Spring Framework.
  • You want to take advantage of modern development practices with Kotlin.

Prerequisites

  • A general knowledge of Java, especially functional features like streams, lambda expressions, and method references
  • Basic familiarity with Kotlin and the Spring Framework, such as that covered by the live online training course Getting Started with Spring and Spring Boot (useful but not required)

Recommended follow-up:

About your instructor

  • Ken Kousen is the author of the Kotlin Cookbook (O'Reilly), Modern Java Recipes (O'Reilly), Gradle Recipes for Android (O’Reilly), and Making Java Groovy (Manning), as well as O’Reilly video courses in Android, Groovy, Gradle, advanced Java, and Spring. A JavaOne Rock Star, he’s a regular speaker on the No Fluff Just Stuff conference tour and has spoken at conferences all over the world. Through his company, Kousen I.T., Inc., he’s taught software development training courses to thousands of students.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Review of Kotlin features (50 minutes)

  • Presentation and hands-on exercises: Immutable types; nullability; defining top-level functions; classes, interfaces, and object singletons; companion objects; conditional expressions; collections and arrays
  • Q&A

Break (10 minutes)

Starting a Spring Boot application (30 minutes)

  • Presentation and hands-on exercises: Adding the Kotlin Gradle plug-in; adding the "all-open" plug-ins; selecting compiler options for nullability; specifying dependencies for the JDK and reflection; preparing for tests

Spring controllers in Kotlin (35 minutes)

  • Presentation and hands-on exercises: Defining a web controller; working with view templates; defining a RESTful controller; testing controllers with JUnit 5 Q&A

Break (10 minutes)

Persistence with JPA (35 minutes)

  • Presentation and hands-on exercises: Adding the "kotlin-noarg" dependency; applying the "kotlin-jpa" plug-in; JPA annotations and data classes; defining a Spring Data JPA repository interface
  • Q&A

Break (10 minutes)

Implementing backend services (30 minutes)

  • Presentation and hands-on exercises: Using Spring's @Service annotation; extension functions; exposing an HTTP API; mocking objects for testing
  • Q&A

Additional features (25 minutes)

  • Presentation and hands-on exercises: Externalizing configuration properties; using application.properties; integration and functional testing

Wrap-up and Q&A (5 minutes)