Spring Boot 2.0 Projects
eBook - ePub

Spring Boot 2.0 Projects

Build production-grade reactive applications and microservices with Spring Boot

Mohamed Shazin Sadakath

Compartir libro
  1. 336 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Spring Boot 2.0 Projects

Build production-grade reactive applications and microservices with Spring Boot

Mohamed Shazin Sadakath

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

Develop diverse real-life projects including most aspects of Spring Boot

Key Features

  • Run production-grade based applications using the Spring WebFlux framework
  • Learn to develop high performance, asynchronous applications with Spring Boot
  • Create robust microservice-based applications with Kotlin using Spring Boot

Book Description

Spring is one of the best tools available on the market for developing web, enterprise, and cloud-ready software. The goal of Spring Boot is to provide a set of tools for quickly building Spring applications that are easy to configure, and that make it easy to create and run production-grade Spring-based applications. Spring Boot 2.0 Projects will get you acquainted with important features of the latest version of this application-building tool and will cover basic, as well as advanced topics.

The book starts off by teaching you how to create a web application using Spring Boot, followed by creating a Spring Boot-based simple blog management system that uses Elasticsearch as the data store. As you make your way through the chapters, you'll build a RESTful web services application using Kotlin and the Spring WebFlux framework. Spring WebFlux is a new framework that helps in creating a reactive application in a functional way. Toward the end of the book, you will build a taxi-hailing API with reactive microservices using Spring Boot and a Twitter clone with a Spring Boot backend. Finally, you'll learn how to build an asynchronous email formatter.

What you will learn

  • Learn the fundamental features of Spring Boot 2.0
  • Customize Spring Boot 2.0 applications
  • Build a basic web application
  • Use Redis to build a taxi-hailing API
  • Create a simple blog management system and a Twitter clone
  • Develop a reactive RESTful web service with Kotlin using Spring Boot

Who this book is for

This book is for competent Spring developers who wish to understand how to develop complex yet scalable applications with Spring Boot. You must have a good knowledge of Java programming and be familiar with the basics of Spring.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Spring Boot 2.0 Projects un PDF/ePUB en línea?
Sí, puedes acceder a Spring Boot 2.0 Projects de Mohamed Shazin Sadakath en formato PDF o ePUB, así como a otros libros populares de Computer Science y Programming in Java. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2018
ISBN
9781789134223
Edición
1

Building an API with Reactive Microservices

This chapter will help readers get started on developing reactive microservices using Spring Boot 2.0. It will enable experts as well as beginners in Spring Boot web application development to understand the concepts behind a microservice and how easy it is to use Spring Boot 2.0 to develop a microservice application. It will explain these concepts by walking the reader through the process of developing two microservices related to a Taxi Hailing System, where one will be for the Taxi Service, including functions such as getting available taxis, finding the status of a taxi, updating taxi location, and registering taxis, and the other one will be for the Taxi Booking Service, which will allow users to book a taxi, cancel a taxi, and so on. These two microservices will be running inside a container platform named Docker and will use a Redis instance for persistence, Spring Data Redis Reactive for the model and repository, and Spring WebFlux for controllers.
The following topics will be covered in this chapter:
  • Using Spring Data Redis for persistence
  • Using Spring WebFlux for controllers
  • Using asynchronous data transfer for cross-microservice communication
  • Using Docker to support microservices
  • Demonstrating Saber

Technical requirements

In order to implement the web application using Spring Boot, the following build tools need to be downloaded and installed:
  • To install Java Development Kit (JDK) 8, download it from its official page at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  • To install Maven 3, download it from its official page at https://maven.apache.org/download.cgi
  • To install IntelliJ IDEA, download it from its official page at https://www.jetbrains.com/idea/download/
  • To install Spring Tool Suite (STS), download it from its official page at https://spring.io/tools
  • To install Docker, download it from its official page at https://www.docker.com/get-docker
The source code for this chapter can be found at https://github.com/PacktPublishing/Spring-Boot-2.0-Projects-Fundamentals-of-Spring-Boot-2.0, under the Chapter06 directory.

Getting started

In this section, the reader will get an overview of the reactive microservices being developed. The requirements, design, and implementation details will be discussed in brief.

Microservices architecture

Microservices architecture has become a buzzword within the last five years with the emergence of cloud-based hosting services. There is no fixed definition of this architecture, but in general terms, microservices architecture is a way of designing and implementing software as a collection of independently deployable services that are highly coherent and loosely coupled. Each of these services will be designed, implemented, deployed, and maintained by a team of usually 5 to 10 members with complete ownership and accountability. Each microservice will address a particular domain of a system (user, sales, and others), can be developed using different programming languages, and can have its own persistence and an API to enable synchronous communication and/or a publisher/subscriber model for asynchronous communication.
Microservices architecture was preceded by monolithic architecture, where all the functionality was grouped into a single application that loaded and ran inside a single process. This monolithic software was really heavy and took a lot of time to load, and scaling required the entire application to be scaled by replicating it in multiple servers. There was no way to scale a particular functionality alone. This is depicted in the following diagram:
Microservices architecture addressed these pain points by enabling us to run small, highly cohesive applications that do one functionality really well. This could load fast and require fewer resources to function. Scaling of a microservice can be done by distributing it across servers and by replicating it as and when needed. Consider the following diagram:
There are some characteristics that can be found in any Microservices architecture-based software application, which are as follows:
  • Service components: The components in a microservice architecture are services that can communicate via a web request, RPC call, and so on. Unlike library components in a monolithic application where communication happens between library components via in-memory, in-process calls internally without an external API.
  • Organized by business domain: In a monolithic application, l...

Índice