liveBook · Manning

What you will learn in Spring Start Here, Second Edition

by Laurentiu Spilca · Manning Early Access Program (MEAP)

Chapter by chapter

Chapter 1: Spring in the real world

Introduces Spring as a widely used Java/JVM application framework and explains that the book’s Java examples teach concepts applicable in other JVM languages.

1.1 Why should we use frameworks? · 1.2 The Spring ecosystem · 1.3 Spring in real-world scenarios · 1.3.1 Using Spring in the development of a backend app · 1.3.2 Using Spring in an automation test app · 1.3.3 Using Spring for the development of a desktop app · 1.4 When not to use frameworks · 1.4.1 You need to have a small footprint · 1.4.2 Security needs dictate custom code · 1.4.3 Abundant existing customizations make a framework impractical · 1.4.4 You won’t benefit from switching to a framework · 1.5 What will you learn in this book · 1.6 Questions · 1.7 Summary

What you learn in chapter 1 →

Chapter 2: The Spring context: Defining beans

Introduces the Spring application context as the place where object instances must be added for Spring to manage them.

2.1 Using the @Bean annotation to create beans · 2.2 Using stereotype annotations to create beans · 2.3 Programmatically creating beans · 2.4 Questions · 2.5 Summary

What you learn in chapter 2 →

Chapter 3: The Spring context: Wiring beans

The chapter introduces how Spring-managed beans collaborate by receiving references to one another, and names two basic ways to establish those relationships.

3.1 Implementing relationships among beans defined in a configuration file · 3.1.1 Wiring the beans using a direct method call between the @Bean methods · 3.1.2 Wiring the beans using the @Bean annotated method’s parameters · 3.2 Using the @Autowired annotation to inject beans · 3.2.1 Using @Autowired to inject the values through the class fields · 3.2.2 Using @Autowired to inject the values through the constructor · 3.2.3 Using dependency injection through the setter · 3.3 Dealing with circular dependencies · 3.4 Choosing from multiple beans in the Spring context · 3.5 Questions · 3.6 Summary

What you learn in chapter 3 →

Chapter 4: The Spring context: Using abstractions

This introduction explains why Spring applications use interfaces to decouple components and dependency injection to supply implementations.

4.1 Using interfaces to define contracts · 4.1.1 Using interfaces for decoupling implementations · 4.1.2 The requirement of the scenario · 4.1.3 Implementing the requirement without using a framework · 4.2 Using dependency injection with abstractions · 4.2.1 Deciding which objects should be part of the Spring context · 4.2.2 Choosing what to auto-wire from multiple implementations of an abstraction · 4.3 Focusing on object responsibilities with stereotype annotations · 4.4 Questions · 4.5 Summary

What you learn in chapter 4 →

Chapter 5: The Spring context: Bean scopes and life cycle

Introduces bean scopes as Spring’s approaches to creating and managing beans, identifying singleton as the default and prototype as another common scope.

5.1 Using the singleton bean scope · 5.1.1 Singleton beans in real-world scenarios · 5.1.2 Using eager and lazy instantiation · 5.2 Using the prototype bean scope · 5.2.1 Prototype beans in real-world scenarios · 5.3 Questions · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Using aspects with Spring AOP

Introduces aspects as a way to add shared behavior to method calls without repeating it in each method.

6.1 How aspects work in Spring · 6.2 Implementing aspects with Spring AOP · 6.2.1 Implementing a simple aspect · 6.2.2 Altering the intercepted method’s parameters and the returned value · 6.2.3 Intercepting annotated methods · 6.2.4 Other advice annotations you can use · 6.3 The aspect execution chain · 6.4 Questions · 6.5 Summary

What you learn in chapter 6 →

Chapter 7: Understanding Spring Boot and Spring

This introduction shifts the focus to Spring web apps and explains why Spring Boot makes Spring applications quicker to create.

7.1 What is a web app? · 7.1.1 A general overview of a web app · 7.1.2 Different fashions of implementing a web app with Spring · 7.1.3 Using a servlet container in web app development · 7.2 The magic of Spring Boot · 7.2.1 Using a project initialization service to create a Spring Boot project · 7.2.2 Using dependency starters to simplify the dependency management · 7.2.3 Using autoconfiguration by convention based on dependencies · 7.3 Implementing a web app with Spring MVC · 7.4 Questions · 7.5 Summary

What you learn in chapter 7 →

Chapter 8: Implementing web apps with Spring Boot and Spring MVC

Introduces dynamic web views and explains that a template engine displays variable data sent by a controller.

8.1 Implementing web apps with a dynamic view · 8.1.1 Getting data from the HTTP request · 8.1.2 Using query string parameters to send data from client to server · 8.1.3 Using path variables to send data from client to server · 8.2 Using the GET and POST HTTP methods · 8.3 Questions · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: Using the Spring web scopes

Introduces Spring’s three web bean scopes by comparing how long their instances are available.

9.1 Using the request scope in a Spring web app · 9.2 Using the session scope in a Spring web app · 9.3 Using the application scope in a Spring web app · 9.4 Questions · 9.5 Summary

What you learn in chapter 9 →

Chapter 10: Implementing REST endpoints

The introduction explains why AI-generated REST services need careful review and previews the chapter’s endpoint topics.

10.1 Using REST services to exchange data between apps · 10.2 Implementing REST endpoints · 10.3 Managing the HTTP response · 10.3.1 Sending objects as a response body · 10.3.2 Setting the response status and headers · 10.3.3 Managing exceptions at the endpoint level · 10.4 Using a request body to get data from the client · 10.5 Questions · 10.6 Summary

What you learn in chapter 10 →

Chapter 11: Consuming REST endpoints

This introduction explains why a Spring backend may need to call another service’s REST endpoints and why developers need to understand the available approaches.

11.1 What do you need to know? · 11.2 Calling REST endpoints using RestClient · 11.3 Calling REST endpoints using Spring Cloud OpenFeign · 11.4 Calling REST endpoints using WebClient · 11.5 Questions · 11.6 Summary

What you learn in chapter 11 →

Chapter 12: Using data sources in Spring apps

The introduction explains why database persistence matters to Spring apps and introduces the chapter’s topic without teaching its implementation.

12.1 What a data source is · 12.2 Using JdbcTemplate to work with persisted data · 12.3 Customizing the configuration of the data source · 12.3.1 Defining the data source in the application properties file · 12.3.2 Using a custom DataSource bean · 12.4 Questions · 12.5 Summary

What you learn in chapter 12 →

Chapter 13: Using transactions in Spring apps

This introduction explains why transactions are needed to keep related data changes consistent when one step fails.

13.1 Transactions · 13.2 How transactions work in Spring · 13.3 Using transactions in Spring apps · 13.4 Questions · 13.5 Summary

What you learn in chapter 13 →

Chapter 14: Implementing data persistence with Spring Data

Introduces the persistence layer and explains how Spring Data reduces the code needed to work with database data.

14.1 What Spring Data is · 14.2 How Spring Data works · 14.3 Using Spring Data JDBC · 14.4 Questions · 14.5 Summary

What you learn in chapter 14 →

Chapter 15: Unit testing in Spring apps

The chapter introduction defines tests, distinguishes unit from integration tests, and explains why testing protects an app’s capabilities over time.

15.1 Writing correctly implemented tests · 15.2 Implementing unit tests in Spring apps · 15.3 Questions · 15.4 Summary

What you learn in chapter 15 →

Chapter 16: Implementing integration tests for Spring apps

This introduction explains what Spring integration tests check and why they complement unit tests.

16.1 Implementing Spring integration tests · 16.2 Implementing controller integration tests · 16.3 Questions · 16.4 Summary

What you learn in chapter 16 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.