Preface |
|
xvii | |
Acknowledgments |
|
xix | |
About this book |
|
xxi | |
About the author |
|
xxv | |
About the cover illustration |
|
xxvi | |
|
PART 1 FOUNDATIONAL SPRING |
|
|
1 | (160) |
|
1 Getting started with Spring |
|
|
3 | (26) |
|
|
4 | (2) |
|
1.2 Initializing a Spring application |
|
|
6 | (11) |
|
Initializing a Spring project with Spring Tool Suite |
|
|
7 | (4) |
|
Examining the Spring project structure |
|
|
11 | (6) |
|
1.3 Writing a Spring application |
|
|
17 | (9) |
|
|
18 | (1) |
|
|
19 | (1) |
|
|
20 | (1) |
|
Building and running the application |
|
|
21 | (2) |
|
Getting to know Spring Boot DevTools |
|
|
23 | (2) |
|
|
25 | (1) |
|
1.4 Surveying the Spring landscape |
|
|
26 | (3) |
|
The core Spring Framework |
|
|
26 | (1) |
|
|
26 | (1) |
|
|
27 | (1) |
|
|
27 | (1) |
|
Spring Integration and Spring Batch |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
28 | (1) |
|
2 Developing web applications |
|
|
29 | (32) |
|
2.1 Displaying information |
|
|
30 | (11) |
|
|
31 | (3) |
|
Creating a controller class |
|
|
34 | (4) |
|
|
38 | (3) |
|
2.2 Processing form submission |
|
|
41 | (8) |
|
2.3 Validating form input |
|
|
49 | (5) |
|
Declaring validation rules |
|
|
50 | (2) |
|
Performing validation at form binding |
|
|
52 | (2) |
|
Displaying validation errors |
|
|
54 | (1) |
|
2.4 Working with view controllers |
|
|
54 | (3) |
|
2.5 Choosing a view template library |
|
|
57 | (4) |
|
|
59 | (2) |
|
|
61 | (33) |
|
3.1 Reading and writing data with JDBC |
|
|
62 | (16) |
|
Adapting the domain for persistence |
|
|
64 | (1) |
|
Working with JdbcTemplate |
|
|
65 | (5) |
|
Defining a schema and preloading data |
|
|
70 | (3) |
|
|
73 | (5) |
|
3.2 Working with Spring Data JDBC |
|
|
78 | (7) |
|
Adding Spring Data JDBC to the build |
|
|
78 | (1) |
|
Defining repository interfaces |
|
|
79 | (2) |
|
Annotating the domain for persistence |
|
|
81 | (2) |
|
Preloading data with CommandLineRunner |
|
|
83 | (2) |
|
3.3 Persisting data with Spring Data JPA |
|
|
85 | (9) |
|
Adding Spring Data JPA to the project |
|
|
85 | (1) |
|
Annotating the domain as entities |
|
|
86 | (3) |
|
Declaring JPA repositories |
|
|
89 | (1) |
|
|
90 | (4) |
|
4 Working with nonrelational data |
|
|
94 | (19) |
|
4.1 Working with Cassandra repositories |
|
|
95 | (11) |
|
Enabling Spring Data Cassandra |
|
|
95 | (3) |
|
Understanding Cassandra data modeling |
|
|
98 | (1) |
|
Mapping domain types for Cassandra persistence |
|
|
99 | (6) |
|
Writing Cassandra repositories |
|
|
105 | (1) |
|
4.2 Writing MongoDB repositories |
|
|
106 | (7) |
|
Enabling Spring Data MongoDB |
|
|
106 | (1) |
|
Mapping domain types to documents |
|
|
107 | (4) |
|
Writing MongoDB repository interfaces |
|
|
111 | (2) |
|
|
113 | (27) |
|
5.1 Enabling Spring Security |
|
|
114 | (2) |
|
5.2 Configuring authentication |
|
|
116 | (9) |
|
In-memory user details service |
|
|
118 | (1) |
|
Customizing user authentication |
|
|
119 | (6) |
|
5.3 Securing web requests |
|
|
125 | (9) |
|
|
125 | (3) |
|
Creating a custom login page |
|
|
128 | (3) |
|
Enabling third-party authentication |
|
|
131 | (2) |
|
Preventing cross-site request forgery |
|
|
133 | (1) |
|
5.4 Applying method-level security |
|
|
134 | (2) |
|
|
136 | (4) |
|
6 Working with configuration properties |
|
|
140 | (21) |
|
6.1 Fine-tuning autoconfiguration |
|
|
141 | (7) |
|
Understanding Spring's environment abstraction |
|
|
142 | (1) |
|
Configuring a data source |
|
|
143 | (2) |
|
Configuring the embedded server |
|
|
145 | (1) |
|
|
146 | (2) |
|
Using special property values |
|
|
148 | (1) |
|
6.2 Creating your own configuration properties |
|
|
148 | (7) |
|
Defining configuration property holders |
|
|
151 | (2) |
|
Declaring configuration property metadata |
|
|
153 | (2) |
|
6.3 Configuring with profiles |
|
|
155 | (6) |
|
Defining profile-specific properties |
|
|
156 | (2) |
|
|
158 | (1) |
|
Conditionally creating beans with profiles |
|
|
159 | (2) |
|
|
161 | (116) |
|
|
163 | (23) |
|
7.1 Writing RESTful controllers |
|
|
164 | (10) |
|
Retrieving data from the server |
|
|
164 | (6) |
|
Sending data to the server |
|
|
170 | (1) |
|
Updating data on the server |
|
|
171 | (2) |
|
Deleting data from the server |
|
|
173 | (1) |
|
7.2 Enabling data-backed services |
|
|
174 | (6) |
|
Adjusting resource paths and relation names |
|
|
177 | (2) |
|
|
179 | (1) |
|
7.3 Consuming REST services |
|
|
180 | (6) |
|
|
182 | (1) |
|
|
183 | (1) |
|
|
184 | (1) |
|
|
184 | (2) |
|
|
186 | (24) |
|
|
187 | (5) |
|
8.2 Creating an authorization server |
|
|
192 | (9) |
|
8.3 Securing an API with a resource server |
|
|
201 | (3) |
|
8.4 Developing the client |
|
|
204 | (6) |
|
9 Sending messages asynchronously |
|
|
210 | (33) |
|
9.1 Sending messages with JMS |
|
|
211 | (15) |
|
|
211 | (3) |
|
Sending messages with JmsTemplate |
|
|
214 | (8) |
|
|
222 | (4) |
|
9.2 Working with RabbitMQ and AMQJP |
|
|
226 | (10) |
|
Adding RabbitMQ to Spring |
|
|
227 | (1) |
|
Sending messages with RabbitTemplate |
|
|
228 | (4) |
|
Receiving messages from RabbitMQ |
|
|
232 | (4) |
|
|
236 | (7) |
|
Setting up Spring for Kafka messaging |
|
|
237 | (1) |
|
Sending messages with KafkaTemplate |
|
|
238 | (3) |
|
|
241 | (2) |
|
|
243 | (34) |
|
10.1 Declaring a simple integration flow |
|
|
244 | (7) |
|
Defining integration flows with XML |
|
|
246 | (1) |
|
Configuring integration flows in Java |
|
|
247 | (2) |
|
Using Spring Integration's DSL configuration |
|
|
249 | (2) |
|
10.2 Surveying the Spring Integration landscape |
|
|
251 | (16) |
|
|
252 | (1) |
|
|
253 | (1) |
|
|
254 | (2) |
|
|
256 | (1) |
|
|
257 | (3) |
|
|
260 | (2) |
|
|
262 | (1) |
|
|
263 | (2) |
|
|
265 | (2) |
|
10.3 Creating an email integration flow |
|
|
267 | (10) |
|
|
277 | (108) |
|
|
279 | (29) |
|
11.1 Understanding reactive programming |
|
|
280 | (3) |
|
Defining Reactive Streams |
|
|
281 | (2) |
|
11.2 Getting started with Reactor |
|
|
283 | (4) |
|
Diagramming reactive flows |
|
|
285 | (1) |
|
Adding Reactor dependencies |
|
|
286 | (1) |
|
11.3 Applying common reactive operations |
|
|
287 | (21) |
|
|
287 | (4) |
|
|
291 | (4) |
|
Transforming and filtering reactive streams |
|
|
295 | (10) |
|
Performing logic operations on reactive types |
|
|
305 | (3) |
|
12 Developing reactive APIs |
|
|
308 | (29) |
|
12.1 Working with Spring WebFlux |
|
|
309 | (7) |
|
Introducing Spring WebRux |
|
|
310 | (2) |
|
Writing reactive controllers |
|
|
312 | (4) |
|
12.2 Defining functional request handlers |
|
|
316 | (4) |
|
12.3 Testing reactive controllers |
|
|
320 | (5) |
|
|
320 | (3) |
|
|
323 | (1) |
|
Testing with a live server |
|
|
324 | (1) |
|
12.4 Consuming REST APIs reactively |
|
|
325 | (8) |
|
|
326 | (2) |
|
|
328 | (1) |
|
|
329 | (1) |
|
|
329 | (2) |
|
|
331 | (2) |
|
12.5 Securing reactive web APIs |
|
|
333 | (4) |
|
Configuring reactive web security |
|
|
333 | (2) |
|
Configuring a reactive user details service |
|
|
335 | (2) |
|
13 Persisting data reactively |
|
|
337 | (32) |
|
|
338 | (15) |
|
Defining domain entities for R2DBC |
|
|
339 | (4) |
|
Defining reactive repositories |
|
|
343 | (2) |
|
Testing R2DBC repositories |
|
|
345 | (2) |
|
Defining an OrderRepository aggregate root service |
|
|
347 | (6) |
|
13.2 Persisting document data reactively with MongoDB |
|
|
353 | (8) |
|
Defining domain document types |
|
|
354 | (2) |
|
Defining reactive MongoDB repositories |
|
|
356 | (1) |
|
Testing reactive MongoDB repositories |
|
|
357 | (4) |
|
13.3 Reactively persisting data in Cassandra |
|
|
361 | (8) |
|
Defining domain classes for Cassandra persistence |
|
|
362 | (3) |
|
Creating reactive Cassandra repositories |
|
|
365 | (1) |
|
Testing reactive Cassandra repositories |
|
|
366 | (3) |
|
|
369 | (16) |
|
|
370 | (2) |
|
14.2 Creating a simple RSocket server and client |
|
|
372 | (10) |
|
Working with request-response |
|
|
372 | (4) |
|
Handling request-stream messaging |
|
|
376 | (2) |
|
Sendingfire-and-forgel messages |
|
|
378 | (1) |
|
Sending messages bidirectionally |
|
|
379 | (3) |
|
14.3 Transporting RSocket over WebSocket |
|
|
382 | (3) |
|
|
385 | (74) |
|
15 Working with Spring Boot Actuator |
|
|
387 | (36) |
|
15.1 Introducing Actuator |
|
|
388 | (3) |
|
Configuring Actuator's base path |
|
|
389 | (1) |
|
Enabling and disabling Actuator endpoints |
|
|
390 | (1) |
|
15.2 Consuming Actuator endpoints |
|
|
391 | (17) |
|
Fetching essential application information |
|
|
392 | (3) |
|
Viewing configuration details |
|
|
395 | (8) |
|
Viewing application activity |
|
|
403 | (2) |
|
|
405 | (3) |
|
15.3 Customizing Actuator |
|
|
408 | (12) |
|
Contributing information to the /info endpoint |
|
|
408 | (7) |
|
Defining custom health indicators |
|
|
414 | (1) |
|
Registering custom metrics |
|
|
415 | (2) |
|
Creating custom endpoints |
|
|
417 | (3) |
|
|
420 | (3) |
|
|
423 | (12) |
|
16.1 Using Spring Boot Admin |
|
|
424 | (3) |
|
|
424 | (2) |
|
Registering Admin clients |
|
|
426 | (1) |
|
16.2 Exploring the Admin server |
|
|
427 | (4) |
|
Viewing general application health and information |
|
|
428 | (1) |
|
|
428 | (1) |
|
Examining environment properties |
|
|
429 | (2) |
|
Viewing and setting logging levels |
|
|
431 | (1) |
|
16.3 Securing the Admin server |
|
|
431 | (4) |
|
Enabling login in the Admin server |
|
|
432 | (1) |
|
Authenticating with the Actuator |
|
|
433 | (2) |
|
17 Monitoring Spring with JMX |
|
|
435 | (8) |
|
17.1 Working with Actuator MBeans |
|
|
435 | (2) |
|
17.2 Creating your own MBeans |
|
|
437 | (3) |
|
17.3 Sending notifications |
|
|
440 | (3) |
|
|
443 | (16) |
|
18.1 Weighing deployment options |
|
|
444 | (1) |
|
18.2 Building executable JAR files |
|
|
445 | (1) |
|
18.3 Building container images |
|
|
446 | (9) |
|
|
449 | (2) |
|
Enabling graceful shutdown |
|
|
451 | (1) |
|
Working ivith application liveness and readiness |
|
|
452 | (3) |
|
18.4 Building and deploying WAR files |
|
|
455 | (2) |
|
18.5 The end is where we begin |
|
|
457 | (2) |
Appendix Bootstrapping Spring applications |
|
459 | (20) |
Index |
|
479 | |