Share E-Book

AuthorPeter Späth, Felipe Gutierrez

Quickly and productively build complex Kotlin-based Spring applications and microservices out of the box, with minimal concern over things such as configurations. This revised edition will show you how to fully leverage the Spring Boot 3 micro-framework and apply it to create enterprise-ready Kotlin-based cloud-native applications, microservices, and web applications that just work. The book covers what has been added to the new Spring Boot 3 release, including improved support for the Kotlin programming language, changes to Stream Editor UI, Maven Preemptive Authentication, building Docker images using cloud-native build packs, building layered jars for optimized Docker images, E2E traceability for configuration properties, many dependency upgrades, support for Spring Data, and much more. This book is your in-depth pragmatic guide for increasing your enterprise Kotlin and cloud application productivity while decreasing development time. It is a no-nonsense guide with case studies of increasing complexity throughout the book. The main author, a senior solutions architect and Principal Technical instructor at Pivotal, the company behind the Spring Framework, shares his experience, insights, and first-hand knowledge about how Spring Boot technology works, and best practices. What You Will Learn • Build cloud-native apps and microservices with the Spring Boot 3 framework • Persist and access your data using and integrating with Spring Data • Message with Kafka, RabbitMQ, and WebSockets • Explore Spring Cloud projects • Extend Spring Boot by creating your own Spring Boot Starter and @Enable feature • Test and deploy Spring Boot with best practices • Effectively use Kotlin as a programming language for Spring applications Who This Book Is For Experienced Spring, Java, and Kotlin developers seeking increased productivity gains and decreased complexity and development time in their applications and software services

AI Reading Assistant

Summary and highlights from this book's index; jump to passages in the text

Passage locations
Tags
No tags
Publisher: Apress
Publish Year: 2025
Language: 英文
Pages: 922
File Format: PDF
File Size: 18.9 MB
Support Statistics
¥.00 · 0times
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Pro Spring Boot 3 with Kotlin In-Depth Guide to Best Practices for Cloud-Native and Microservices Development — Third Edition — Peter Späth Felipe Gutierrez
Pro Spring Boot 3 with Kotlin In-Depth Guide to Best Practices for Cloud-Native and Microservices Development Third Edition Peter Späth Felipe Gutierrez
Pro Spring Boot 3 with Kotlin: In-Depth Guide to Best Practices for Cloud-Native and Microservices Development, Third Edition ISBN-13 (pbk): 979-8-8688-1130-2 ISBN-13 (electronic): 979-8-8688-1131-9 https://doi.org/10.1007/979-8-8688-1131-9 Copyright © 2025 by Peter Späth, Felipe Gutierrez This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Melissa Duffy Desk Editor: Laura Berendson Editorial Project Manager: Gryffin Winkler Copy Editor: Kezia Endsley Cover designed by eStudioCalamar Cover image designed by Image by esiuL from Pixabay Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, Suite 4600, New York, NY 10004-1562, USA. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@ springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail booktranslations@springernature.com; for reprint, paperback, or audio rights, please e-mail bookpermissions@springernature.com. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub. For more detailed information, please visit https://www.apress.com/gp/services/ source-code. If disposing of this product, please recycle the paper Peter Späth Leipzig, Sachsen, Germany Felipe Gutierrez Albuquerque, NM, USA
To Alina
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
(This page has no text content)
xv About the Authors Felipe Gutierrez is a senior platform architect at VMware, the creators of Spring Boot and Spring Framework, where he serves as a senior consultant with the Spring team. He has more than 25 years of IT experience, during which time he developed programs for companies in multiple vertical industries such as government, retail, healthcare, education, and banking. He also develops in Kotlin, Groovy, RabbitMQ, and other technologies. He has also consulted for companies such as Nokia, Apple, Redbox, and Qualcomm, among others. He received his bachelor’s and master’s degrees in computer science from Instituto Tecnologico y de Estudios Superiores de Monterrey, Campus Ciudad de Mexico. Peter Späth graduated in 2002 as a physicist and soon afterward became an IT consultant, mainly for Java-related projects. In 2016, he decided to concentrate on writing books on various aspects, but with the main focus on software development. With two books about graphics and sound processing, three books on Android app development, and several books on Java, Kotlin, Jakarta EE, and Spring development, Peter continues his effort in writing software development-related literature.
xvii About the Technical Reviewer Massimo Nardone has more than 27 years of experience in security, web/mobile development, and cloud and IT architecture. His true IT passions are security and Android. He has been programming and teaching others how to program with Android, Perl, PHP, Java, VB, Python, C/C++, and MySQL for more than 27 years. He holds a master’s in computing science from the University of Salerno, Italy. He has worked as a chief information security officer (CISO), software engineer, chief security architect, security executive, OT/IoT/IIoT security leader, and architect for many years.
xix Introduction This book is a transcription to the Kotlin language. Genuine Kotlin programming techniques have been used extensively and the code has been tested thoroughly. This way, even though the Kotlin constructs are not explained in great detail, you learn about Kotlin’s expressiveness, learn how to use Kotlin for Spring Boot development, and improve your Kotlin and Spring programming skills, all at the same time.
PART I Introduction
3 © Peter Späth, Felipe Gutierrez 2025 P. Späth and F. Gutierrez, Pro Spring Boot 3 with Kotlin, https://doi.org/10.1007/979-8-8688-1131-9_1 CHAPTER 1 Spring Boot Quick Start Felipe Gutierreza* a 4109 Rillcrest Grove Way Fuquay Varina, NC 27526-3562, Albuquerque, NM, USA Project: Users App The project that you are going to learn how to build, named Users App, will expose a simple CRUD (create, read, update, and delete) API over the web. Here are the requirements for this Users App project: • A user must have a name and an email address. • A map is used to hold the information, using the email address as the key. • It exposes an API that uses CRUD over the web. Initial Setup To start with Spring Boot, you need to have the following installed: • Java: You can install, for example, OpenJDK (https://jdk.java. net/archive/) or Eclipse Temurin (https://adoptium.net/ temurin/releases/). – If you are UNIX user, you can use SDKMAN! (https://sdkman.io/), which works for Linux and macOS. – If you are Windows user, you can use Chocolatey (https://choco- latey.org/).
4 • An integrated development environment (IDE): As a suggestion, you can use Microsoft Visual Studio Code (https://code.visualstudio. com/download), the Community edition of IntelliJ IDEA from JetBrains (https://www.jetbrains.com/idea/download/), or Spring Tools (https://spring.io/tools). • The curl or http command: For http, you can install HTTPie (https://httpie.io/). Both commands are demonstrated later in this chapter. • The jq command: You can install it using the instructions at https:// stedolan.github.io/jq/. Start @ start.spring.io start.spring.io is the official web-based tool for generating Spring Boot projects. It provides a user-friendly interface to quickly set up a new Spring Boot project with your desired dependencies and configurations. Here are some of its key features and benefits: • Streamlined project creation: Eliminates the need to manually configure a project structure and dependencies. • Curated dependencies: Offers a selection of common libraries and frameworks to easily add to your project. • Customization: Allows you to choose the build tool (Maven or Gradle), language (Java, Kotlin, or Groovy), and Spring Boot version. • Downloadable project: Generates a ZIP file containing the configured project ready to be imported into your IDE. • Spring Boot integration: Leverages Spring Boot’s auto-configuration and convention-over-configuration principles for rapid development. Open a browser and go to https://start.spring.io. You should see the Spring Initializr home page, as shown in Figure 1-1. Chapter 1 Spring Boot QuiCk Start
5 Figure 1-1. Spring Initializr home page The home page includes radio buttons to select Project, Language, and Spring Boot. Project metadata includes group, artifact, name, description, package name, packaging, and Java version. Three buttons (Generate, Explore, and Share) are provided at the bottom. Notice that by default the Spring Initializr uses Gradle—Groovy as the project builder, Java as the programming language, JAR for packaging, Java 17, and Spring Boot 3 (at the time of this writing, Spring Boot 3.2.3). Chapter 1 Spring Boot QuiCk Start