3 Getting started with cloud native development

 

This chapter covers

  • Bootstrapping a cloud native project
  • Working with embedded servers and Tomcat
  • Building a RESTful application with Spring MVC
  • Testing a RESTful application with Spring Test
  • Automating the build and tests with GitHub Actions

The cloud native landscape is so broad that getting started can be overwhelming. In part 1 of this book, you got a theoretical introduction to cloud native applications and the processes supporting them, and you had a first hands-on experience building a minimal Spring Boot application and deploying it to Kubernetes as a container. All of that will help you better understand the overall cloud native picture and correctly place the topics I’ll be covering in the rest of the book.

The cloud opened up endless possibilities for what we can achieve with many types of applications. In this chapter, I’ll start with one of the most common types: a web application that exposes its functionality over HTTP through a REST API. I’ll guide you through the development process you’ll follow in all the subsequent chapters, addressing the significant differences between traditional and cloud native web applications, consolidating some necessary aspects of Spring Boot and Spring MVC, and highlighting essential testing and production considerations. I’ll also explain some of the guidelines recommended by the 15-Factor methodology, including dependency management, concurrency, and API first.

3.1 Bootstrapping a cloud native project

3.1.1 One codebase, one application

3.1.2 Dependency management with Gradle and Maven

3.2 Working with embedded servers

3.2.1 Executable JARs and embedded servers

3.2.2 Understanding the thread-per-request model

3.2.3 Configuring the embedded Tomcat

3.3 Building a RESTful application with Spring MVC

3.3.1 REST API first, business logic later

3.3.2 Implementing a REST API with Spring MVC

3.3.3 Data validation and error handling

3.3.4 Evolving APIs for future requirements

3.4 Testing a RESTful application with Spring