Share E-Book
Scan to open this page

Scan with your phone to open this page

AuthorFelipe Gutierrez

This book will teach you how to build complex Spring applications and microservices out of the box, with minimal concern over things like configurations. Pro Spring Boot 3 will show you how to fully leverage Spring Boot 3's robust features and how to apply them to create enterprise-ready applications, microservices, and web/cloud applications that just work. Special focus is given to what's been added in the new Spring Boot 3 release, including support for Java 17 and 19; changes to Spring Security; Spring Boot Actuator with Micrometer updates; GraalVM support; RSocket service interfaces; many dependency upgrades; more flexible support for Spring Data JDBC, the new AOT (Ahead-of-Time Transformation); and much more. This book is your authoritative, pragmatic guide for increasing your enterprise Java and cloud application productivity while decreasing development time. It's a no-nonsense reference packed with casestudies that increase in complexity over the course of the book. The author, a senior solutions architect and Principal Technical instructor with VMware, the company behind the Spring Framework, shares his experience, insights, and firsthand knowledge about how Spring Boot technology works and best practices for getting the most out of it. This is an essential book for your Spring learning and reference library. What You Will Learn • Build web/cloud, microservices, and enterprise applications with the Spring Boot 3 framework • Persist data with JDBC, JPA, and NoSQL databases • Message with JMS, RabbitMQ, WebSockets, and RSocket • Gain a review of Spring Cloud projects • Extend Spring Boot by creating your own Spring Boot Starter and @Enable feature • Test and deploy with Spring Boot with best practices • Understand the new AOT (Ahead-Of-Time Transformations) and the GraalVM support to go native • Use the latest version of Spring Security

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A practical, case-study-driven guide for Java developers who want to build production-ready web, cloud, and microservice applications with Spring Boot 3, covering everything from auto-configuration internals to NoSQL data access and testing. 【Book Arc】 - **Opening (~0%–9%)**: Introduces Spring Boot 3's value proposition—enterprise-ready apps with minimal configuration—and walks through a first "Users App" project, including running tests and booting the app with Gradle. - **Early (~9%–19%)**: Dives into Spring Boot internals: the `SpringApplication` class, auto-configuration (around 146 classes), `@Conditional*` annotations, profiles, and how to customize startup via the fluent `SpringApplicationBuilder` API. - **Early (~19%–28%)**: Moves to web development, showing how to build REST endpoints with both servlet-based (MVC) and reactive (WebFlux) styles, including exception handling with `@ControllerAdvice` and validation. - **Early–Middle (~28%–38%)**: Covers SQL data access with Spring Framework's transaction management, DAO support, and `JdbcTemplate`, plus advanced topics like AOP aspects for error handling and Spring Data JDBC callbacks. - **Middle (~38%–47%)**: Explores Spring Data with JDBC (including `BeforeSaveCallback` for entity enrichment) and then shifts to NoSQL with MongoDB and Redis, reusing the same domain models across different persistence layers. - **Middle (~47%–end of sample)**: Focuses on testing with HAL/HATEOAS media types for integration tests, and shows how to configure Docker Compose for local NoSQL development. 【Key Takeaways】 - **Auto-configuration is the core magic** (Early): Spring Boot inspects your classpath and applies defaults via ~146 auto-configuration classes, so adding a starter like Data JPA automatically wires up the DataSource, transaction manager, and more—saving hours of manual setup. - **`@Conditional*` annotations drive smart defaults** (Early): These annotations filter which beans get created based on your dependencies, letting you override defaults only when needed, which keeps configuration minimal and opinionated. - **Profiles and properties give you environment control** (Early): Using `spring.config.activate.on-profile` in `application.properties` lets you segment configs (e.g., a "cloud" profile) so the same app can run in dev, test, or production without code changes. - **Web development supports both MVC and reactive styles** (Early): You can build endpoints with classic `@RestController` or functional `HandlerFunction`/`ServerRequest` APIs, and Spring Boot auto-detects the web application type (servlet vs. reactive) from your starters. - **Spring Data callbacks simplify entity logic** (Middle): Instead of manual setters, you can implement `BeforeSaveCallback<T>` to populate fields (like a Gravatar URL) automatically before persistence, keeping your domain objects clean. - **AOP aspects clean up error handling** (Early–Middle): Using `@Aspect` with `@Around` advice on repository methods lets you centralize checks (e.g., throwing a `RetroBoardNotFoundException` when an ID isn't found), which then flows into `@ControllerAdvice` for HTTP responses. - **NoSQL persistence reuses the same domain model** (Middle): The book demonstrates that switching from JDBC to MongoDB or Redis requires minimal changes—just annotations like `@Document` and starter dependencies—showing Spring Data's abstraction power. - **Testing with HATEOAS requires new tools** (Middle): For HAL/HATEOAS endpoints, you need dedicated test classes that understand the media type, moving beyond simple `MockMvc` assertions to verify links and embedded resources. 【Reading Tips】 - **Skim the first chapter** if you're already familiar with Spring Boot basics; the quick start is useful for setup but the real value starts in Chapter 2 with internals. - **Deep-read Chapter 2** on auto-configuration and `@Conditional*`—this is the foundation for understanding why Spring Boot "just works" and how to debug when it doesn't. - **Follow the Users App and My Retro App case studies** across chapters; they evolve incrementally (adding SQL, NoSQL, testing), so reading them in sequence reinforces concepts better than jumping around. - **Pay attention to the Gradle build files** in each chapter—they show exactly which starters and dependencies are needed for each feature, which is a practical cheat sheet for your own projects. - **Don't skip the testing sections**; they show real integration test patterns (including HATEOAS) that are often glossed over in other guides but critical for production readiness. 【Coverage Limits】 This guide covers the sample through the NoSQL and testing chapters (~47% of the book). Excerpts do not cover later chapters on messaging (JMS, RabbitMQ, RSocket), Spring Cloud, custom starters, AOT/GraalVM, or Spring Security—those topics are listed in the book's intro but not detailed in the provided material.
Excerpt 1
-Time Transformations) and the GraalVM support to go native • Use the latest version of Spring Security Pro Spring Boot 3 An Authoritative Guide with Best Pr...
View in text
Excerpt 2
onfiguration feature to set defaults that incorporate the best practices for your application. You also learned that Spring Boot, through the auto-configurat...
View in text
Excerpt 3
er.builder() .email("ximena@email.com") .name("Ximena") .password("aw2s0meR!") .active(true) .role(UserRole.USER) .build(); userRepository.save(ximena); User...
View in text
Excerpt 4
.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import lombok.*; import org.springframework.data.annotation.Id; import org.s...
View in text
Excerpt 5
get().isActive()).isTrue(); assertThat(expectedUser.get().getName()).isEqualTo("Norma"); } @Test void deleteByIdTest(){ var expectedUser = userRepository.fin...
View in text
Excerpt 6
tivatedUserEvent: This method accepts a UserActivatedEvent as a parameter value, which will be passed once the message is received and converted back (deseri...
View in text
Excerpt 7
id "com.gorylenko.gradle-git-properties" version "2.4.1" } group = 'com.apress' 581 Chapter 11 Spring Boot aCtuator "tag": "vendor", "values": [ "GraalVM Com...
View in text
Excerpt 8
ilding resilient and scalable microservices architectures. • Spring Cloud Vault for database connections and secrets. HashiCorp Vault is a powerful secrets m...
View in text
Tags
AI categories
BackendJavaCloud Native
Publisher: Apress
Publish Year: 2024
Language: English
Pages: 937
File Format: PDF
File Size: 17.5 MB
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.

Generating text preview…