Cademy logoCademy Marketplace

Course Images

Build RESTful APIs Using Kotlin and Spring Boot

Build RESTful APIs Using Kotlin and Spring Boot

  • 30 Day Money Back Guarantee
  • Completion Certificate
  • 24/7 Technical Support

Highlights

  • On-Demand course

  • 8 hours 25 minutes

  • All levels

Description

A course that focuses on using Kotlin for server-side development using the Spring Boot framework. This hands-on course will help you get familiar with the basics of the Kotlin programming language as well as the entire process of building RESTful APIs using Kotlin Spring Boot.

Kotlin is a modern, concise, and safe programming language and is one of the most popular JVM languages currently. It is also interoperable with Java and other languages and provides many ways to reuse code between multiple platforms for productive programming. Section one covers the course objectives and prerequisites needed to make the most out of this course. In section two, we will be introduced to Kotlin programming language and why it's a powerful language for enterprise development. Section three is about the fundamentals of Kotlin such as Val and var variables in Kotlin, basic string types, while and do-while, and so on. Section five is about classes, inheritance, and interfaces in detail, object keywords for creating instances of the class, type checking, casting, and smart cast. In the next section, we will be introduced to collections, arrays, and lambda expressions in Kotlin. We will also understand the scope functions in Kotlin and its usage. Moving on, we will get started with Kotlin and Spring Boot and have an overview of the app we are going to build. You will also learn to build the course catalog service to manage the courses and to code and learn how to write unit tests for the controller along with coding and learning the usage of RequestParam in the controller endpoint. We will wrap up the course by learning the technique to express relationships in JPA using Entity and data classes in Kotlin. By the end of this course, you will be comfortable writing code using the Kotlin programming language and building RESTful APIs using Spring Boot and Kotlin. All resources and code files are placed here: https://github.com/PacktPublishing/Build-RESTFUL-APIs-using-Kotlin-and-Spring-Boot

What You Will Learn

Learn the Kotlin programming language and its benefits
Write code using the Kotlin programming language
Learn how to build applications using Kotlin
Learn Kotlin and Java interoperability
Integrate Spring Data JPA with Kotlin
Test Kotlin using JUnit5

Audience

This course is for developers who are interested in learning the Kotlin programming language, for developers who are interested in building applications using Kotlin and Spring Boot, and for Java developers who would like to learn the Kotlin programming language. Basic experience working with Java will be an advantage.

Approach

This is a complete hands-on course that helps us get comfortable with writing code in the Kotlin programming language and building RESTful APIs using Spring Boot and Kotlin.

Key Features

Learn integration testing DB layer using TestContainers and JUnit5 * Learn unit testing function calls using the mock library * Build RESTful services using Spring Boot and Kotlin

Github Repo

https://github.com/PacktPublishing/Build-RESTFUL-APIs-using-Kotlin-and-Spring-Boot

About the Author

Dilip Sundarraj

Dilip Sundarraj is a software engineer who has experience with building software since 2008. He is passionate about learning modern technologies and staying up to date with all the modern technologies, tools, frameworks, and more. He loves to share his knowledge with the world and that is one of the key reasons for him to be in the online teaching industry. He loves interacting with other software developers and believes that this helps him share knowledge and learn from them. During his leisure time, he loves to play cricket, watch movies, and work out in the gym to have a balance between physical and mental strength. Dilip has a YouTube channel named Code with Dilip, where he has been sharing a lot of technical content related to languages, frameworks, best practices, and more.

Course Outline

1. Getting Started with Kotlin Programming Language

1. Couse Introduction

In this lecture, we will be introduced to the course.

2. Prerequisites

This video introduces you to the course and its projects.

3. Introduction to Kotlin

In this lecture, we will explain why Kotlin is a powerful language for software development.

4. How Kotlin Works with the JVM

In this lecture, we will explain how Kotlin works with the JVM.


2. Kotlin Fundamentals

1. Project Setup

In this lecture, we will set up the project to explore Kotlin.

2. Hello Kotlin!

In this lecture, we will create a simple HelloKotlin Class and print "Hello Kotlin" in the console.

3. val and var Variables in Kotlin

In this lecture, you will learn about the val and var type in Kotlin to declare the variables.

4. Basic Types - Int, Long, Double, String

In this lecture, we will explore the basic types and the basic operations that can be performed on the basic types.

5. Conditionals - If and When Block

In this lecture, we will explore the if-else block and when block in Kotlin.

6. Ranges, Loops

In this lecture, we will explore ranges and loops.

7. while and do-While

In this lecture, we will explore while and do-while loops.

8. Break, Labels, and Return

In this lecture, we will explore break, labels, and return.


3. Functions in Kotlin

1. Defining and Invoking Functions

In this lecture, we will code and explore diverse types of functions in Kotlin.

2. Default Value Parameters and Named Arguments

In this lecture, we will code and learn about the default parameters and the named arguments for Kotlin functions.

3. Top-Level Functions and Top-Level Properties

In this lecture, we will code and learn about the top-level functions and variables in Kotlin.


4. Classes, Interfaces, and Inheritance

1. Introduction to Class - Creating a Class and Objects

In this lecture, we will code and learn about creating a class and instance of a class in Kotlin.

2. Primary Constructors

In this lecture, you will learn about primary conductors.

3. Secondary Constructors

In this lecture, we will code and learn about the secondary constructor in Kotlin.

4. Initializer Code Using init Block

In this lecture, we will code and learn about the usage of init block to run some initialization logic during the instance creation.

5. Data Classes

In this lecture, we will code and learn about the data class in Kotlin.

6. Custom Getters and Setters

In this lecture, we will code and learn about creating custom getters and setters in Kotlin.

7. Inheritance - Extending Classes

In this lecture, we will code and learn about implementing inheritance in Kotlin.

8. Inheritance - Override Functions, Variables

In this lecture, we will code and learn about overriding functions and variables in Kotlin.

9. Object Keyword for Creating Instance of the Class

In this lecture, we will code and learn about the object keyword and its usage in Kotlin.

10. Companion Object Keyword

In this lecture, we will code and learn about the companion object keyword and its usage in Kotlin.

11. Interfaces

In this lecture, we will code and learn about the Interfaces in Kotlin.

12. Interfaces - Handling Conflicting Functions

In this lecture, we will code and learn about the handling conflicting functions in the implementation class.

13. Interfaces - Defining and Overriding Variables

In this lecture, we will code and learn about using variables in Kotlin Interfaces.

14. Visibility Modifiers

In this lecture, we will code and learn about visibility modifiers in Kotlin.

15. Type Checking, Casting, and Smart Cast

In this lecture, we will code and learn about type checking, casting, and smart casting in Kotlin.

16. Enum Class

In this lecture, we will code and learn about Enum classes in Kotlin.


5. Nulls in Kotlin

1. Nullable and Non-Nullable Types in Kotlin

In this lecture, we will code and learn about the nullable and non-nullable types in Kotlin.

2. Safe Call(?), Elvis Operator (? :), and Non-Null Assertion(!!) to Deal with Null Values

In this lecture, we will code and learn about the performing operations on a nullable type using the Safe and Elvis operators.

3. Invoking or Assigning a Nullable Type to a Non-Nullable Type

In this lecture, we will code and learn about using a nullable type to deal with non-nullable types.


6. Collections, Arrays, and Lambda Expressions

1. Introduction to Collections

In this lecture, we will be introduced to collections and learn about mutable and immutable collections.

2. Introduction to Lambda Expressions

In this lecture, we will give you all an introduction to lambda expressions and explore lambda expressions using different examples.

3. Lambdas and Higher Order Functions

In this lecture, we will code and explore how to create higher order functions using lambdas.

4. Filter Operations on Kotlin Collections

In this lecture, we will code and explore the filter operator in collections.

5. Map Operations on Kotlin Collections

In this lecture, we will code and explore the map operator in collections.

6. FlatMap Operations in Collections

In this lecture, we will code and explore about the FlatMap operator and when it can be used when working with collections.

7. Working with HashMaps

In this lecture, we will code and explore the different operators that can be used when working with HashMaps.

8. Lazy Evaluation of Collections Using Sequences

In this lecture, we will explore an alternative to work on the collection using sequences for lazy evaluation.

9. Nullability in Collections

In this lecture, we will code and explore nullability and how it works with Kotlin.


7. Exceptions in Kotlin and Scope Functions

1. Part 1 - Handling Exceptions in Kotlin Using try-catch

In this lecture, we will code and learn about the exceptions in Kotlin and how to handle them.

2. Part 2 - Introduction to Scope Functions

In this lecture, we will cover scope functions in Kotlin.

3. Apply and Also Scope Function

In this lecture, we will code and explore the also and apply scope function.

4. Let Scope Function

In this lecture, we will code and explore the let scope function.

5. With and Run Scope Function

In this lecture, we will code and explore the with and run scope function.


8. Getting Started with Kotlin and Spring Boot

1. Overview of the App and Project Setup

In this lecture, we will see an overview of the app and set up the base project for this course.

2. Build a Simple Endpoint - Greeting Controller

In this lecture, we will build a simple rest endpoint using Kotlin and Spring Boot.

3. Constructor Injection in Spring

In this lecture, we will build a service layer and learn to perform constructor injection in Spring Boot.

4. Setting Up Different Profiles in Spring Boot

In this lecture, we will code and learn to set up different profiles in Spring Boot.

5. Set Up Logging in Kotlin

In this lecture, we will set up the logging for the application.


9. Integration/Unit Testing Using Junit 5

1. Introduction to Automated Tests and Setting Up JUnit5

In this lecture, we will explain about automated tests and set up test folders for unit and integration tests.

2. Integration Test for Controller

In this lecture, we will code and learn to write an integration test for the controller endpoint.

3. Unit Test for Controller - Using the Mock Mocking Library

In this lecture, we will code and learn to write unit test for the controller endpoint.


10. Build the Course Catalog Service

1. Set Up the Course Entity and CourseDTO

In this lecture, we will code the Entity and DTO for the course catalog service.

2. Create CourseRepository and Configure JPA in application.yml File

In this lecture, we will code and configure the JPA and set up the repository in the project.

3. Build the POST Endpoint for Adding New Course

In this lecture, we will code the POST endpoint to add a new course.

4. Integration Test for the POST Endpoint Using JUnit5

In this lecture, we will write the Integration test for the POST endpoint to create a new course.

5. Build the Get Endpoint to Retrieve All Courses

In this lecture, we will code the GET endpoint to retrieve all the courses.

6. Integration Test for the GET Endpoint to Retrieve All the Courses

In this lecture, we will code the write the integration test for the GET endpoint to retrieve all the courses.

7. Build the Update Endpoint to Update a Course

In this lecture, we will code the PUT endpoint to update an existing course.

8. Integration Test for the PUT Endpoint Using JUnit5

In this lecture, we will write the integration test for the PUT endpoint to update an existing course.

9. Build the DELETE Endpoint to Delete a Course

In this lecture, we will code the Delete endpoint to delete a course using its ID.


11. Unit Testing Controller Layer (Web Tier)

1. Setting Up the Unit Test for the CourseController

In this lecture, we will set up the unit test for the CourseController.

2. Unit Test for the Post Endpoint in CourseController

In this lecture, we will write the unit test for the POST endpoint in CourseController.

3. Unit Test for the GET Endpoint in CourseController

In this lecture, we will write the unit test for the GET endpoint in CourseController.

4. Unit Test for the PUT Endpoint in CourseController

In this lecture, we will write the unit test for the PUT endpoint in CourseController.

5. Unit Test for the DELETE Endpoint in CourseController

In this lecture, we will write the unit test for the DELETE endpoint in CourseController.


12. Bean Validation Using Validators and ControllerAdvice

1. Name and Category as Mandatory Using @NotBlank Annotation

In this lecture, we will the bean validation for the CourseDTO by making the name and category as mandatory.

2. Implement Custom Error Handling Using ControllerAdvice Pattern

In this lecture, we will implement a custom error handler using the ControllerAdvice pattern to handle Bean Validation errors.

3. Handle Global RuntimeException Using ControllerAdvice Pattern

In this lecture, we will implement a custom error handler using the ControllerAdvice pattern for handling any RuntimeException.


13. Custom JPA Queries Using Spring Data JPA and DB Layer Testing Using @DataJpaTest

1. Retrieve Courses by Name using JPA Query Creation Function

In this lecture, we will write a custom JPA function to retrieve the courses by their name using the JPA helper function.

2. Retrieve Courses by Name Using Native SQL Query

In this lecture, we will write a custom JPA function to retrieve the courses by their name using the Native SQL query.

3. Testing Multiple Sets of Data Using @Parameterized Test

In this lecture, we will code and learn about testing with multiple sets of data using the @Parameterized test annotation.


14. GET Endpoint to Retrieve Courses by Name Using @RequestParam

1. Use Existing GET Endpoint to Retrieve Courses by Name

In this lecture, we will update the GET endpoint to retrieve the courses by their name using the @RequestParam annotation.

2. Write Integration Test to Retrieve Course by Name

In this lecture, we will write the integration test to get the courses by their name.


15. Entity Relationships Using Spring Data JPA

1. Adding Instructor Entity into the Course Catalog Service

In this lecture, we will be introduced to the instructor entity and its importance.

2. Adding the Relationship to the Entity Class

In this lecture, we will code and learn to implement the relationship between the course and instructor entity.

3. Instructor Controller to Manage Instructor Data

In this lecture, we will build the controller that's going to manage the instructor data.

4. Update CourseService to Validate Instructor Data

In this lecture, we will add business logic to make sure the instructor is valid for every new course that's added.

5. Fix the CourseController Integration Tests

In this lecture, we will fix the integration test cases that are impacted by the addition of instructor to the course catalog service.

6. Fix the CourseController Unit Tests

In this lecture, we will fix the unit test cases that are impacted by the addition of an instructor to the course catalog service.


16. Integrating with Postgres DB

1. Setting Up the Postgres DB and App to Interact with Postgres

In this lecture, we will set up and configure the Postgres DB into the course catalog service.

2. Test the App with Postgres DB

In this lecture, we will test and make sure the course catalog service works seamlessly with the Postgres DB.


17. Integration Testing Using TestContainers

1. Setting Up TestContainers for the Integration Test

In this lecture, we will set up and configure the TestContainers to run the integration test.

2. Configure @DataJpaTest with TestContainers

In this lecture, we will set up and configure the TestContainers to run the integration test for the DB integration tests.


18. Java and Kotlin Interoperability

1. Invoking Kotlin Code from Java Class

In this lecture, we will code and learn about invoking the Kotlin from Java source code.

2. Invoking Java Code from Kotlin

In this lecture, we will code and learn about invoking the Java from Kotlin Source Code.

3. Useful JVM Annotations in Kotlin

In this lecture, we will code and learn about the different JVM annotations that are part of Kotlin and are helpful when invoking Kotlin from Java code.

Course Content

  1. Build RESTful APIs Using Kotlin and Spring Boot

About The Provider

Packt
Packt
Birmingham
Founded in 2004 in Birmingham, UK, Packt’s mission is to help the world put software to work in new ways, through the delivery of effective learning and i...
Read more about Packt

Tags

Reviews