List of Listings

Chapter 1. Getting started with Spring

Listing 1.1. The initial Maven build specification

Listing 1.2. The Taco Cloud bootstrap class

Listing 1.3. A baseline application test

Listing 1.4. The homepage controller

Listing 1.5. The Taco Cloud homepage template

Listing 1.6. A test for the homepage controller

Chapter 2. Developing web applications

Listing 2.1. Defining taco ingredients

Listing 2.2. The beginnings of a Spring controller class

Listing 2.3. The complete design-a-taco page

Listing 2.4. Handling POST requests with @PostMapping

Listing 2.5. A domain object defining a taco design

Listing 2.6. A controller to present a taco order form

Listing 2.7. A taco order form view

Listing 2.8. Handling a taco order submission

Listing 2.9. A domain object for taco orders

Listing 2.10. Adding validation to the Taco domain class

Listing 2.11. Validating order fields

Listing 2.12. Validating a POSTed Taco

Listing 2.13. Validating a POSTed Order

Listing 2.14. Displaying validation errors

Listing 2.15. Declaring a view controller

Chapter 3. Working with data

Listing 3.1. Querying a database without JdbcTemplate

Listing 3.2. Querying a database with JdbcTemplate

Listing 3.3. Adding ID and timestamp fields to the Taco class

Listing 3.4. Beginning an ingredient repository with JdbcTemplate

Listing 3.5. Querying the database with JdbcTemplate

Listing 3.6. Inserting data with JdbcTemplate

Listing 3.7. Injecting and using a repository in the controller

Listing 3.8. Defining the Taco Cloud schema

Listing 3.9. Preloading the database

Listing 3.10. Implementing TacoRepository with JdbcTemplate

Listing 3.11. Injecting and using TacoRepository

Listing 3.12. Saving taco designs and linking them to orders

Listing 3.13. Creating a SimpleJdbcInsert from a JdbcTemplate

Listing 3.14. Using SimpleJdbcInsert to insert data

Listing 3.15. Using an OrderRepository in OrderController

Listing 3.16. Annotating Ingredient for JPA persistence

Listing 3.17. Annotating Taco as an entity

Listing 3.18. Annotating Order as a JPA entity

Chapter 4. Securing Spring

Listing 4.1. A barebones configuration class for Spring Security

Listing 4.2. Defining users in an in-memory user store

Listing 4.3. Authenticating against a JDBC-based user store

Listing 4.4. Customizing user detail queries

Listing 4.5. Defining a user entity

Listing 4.6. Defining a custom user details service

Listing 4.7. A user registration controller

Listing 4.8. A Thymeleaf registration form view

Listing 4.9. Using Spring expressions to define authorization rules

Chapter 5. Working with configuration properties

Listing 5.1. Enabling configuration properties in OrderController

Listing 5.2. Extracting pageSize to a holder class

Chapter 6. Creating REST services

Listing 6.1. Angular component for displaying recent tacos

Listing 6.2. A RESTful controller for taco design API requests

Listing 6.3. A list of taco resources that includes hyperlinks

Listing 6.4. Adding hyperlinks to resources

Listing 6.5. A taco resource carriying domain data and a list of hyperlinks

Listing 6.6. A resource assembler that assembles taco resources

Listing 6.7. Applying Spring Data REST’s base path to a controller

Listing 6.8. Adding custom links to a Spring Data REST endpoint

Chapter 8. Sending messages asynchronously

Listing 8.1. Sending an order with .send() to a default destination

Listing 8.2. Pulling orders from a queue

Listing 8.3. Receiving an already-converted Order object

Listing 8.4. An OrderListener component that listens for orders

Listing 8.5. Sending a message with RabbitTemplate.send()

Listing 8.6. Pulling orders from RabbitMQ with RabbitTemplate

Listing 8.7. Declaring a method as a RabbitMQ message listener

Listing 8.8. Sending orders with KafkaTemplate

Listing 8.9. Receiving orders with @KafkaListener

Chapter 9. Integrating Spring

Listing 9.1. Message gateway interface to transform method invocations into messages

Listing 9.2. Defining an integration flow with Spring XML configuration

Listing 9.3. Using Java configuration to define an integration flow

Listing 9.4. Providing a fluent API for designing integration flows

Listing 9.5. Defining an integration flow to accept emails and submit them as orders

Listing 9.6. Converting incoming emails to taco orders using an integration transformer

Listing 9.7. Posting orders to the Taco Cloud API via a message handler

Chapter 11. Developing reactive APIs

Listing 11.1. Using WebTestClient to test DesignTacoController

Listing 11.2. Configuring Spring Security for a Spring WebFlux application

Chapter 12. Persisting data reactively

Listing 12.1. Annotating the Taco class for Cassandra persistence

Listing 12.2. Mapping the Order class to a Cassandra tacoorders table

Chapter 13. Discovering services

Listing 13.1. Configuring Eureka for two peers using Spring profiles

Chapter 14. Managing configuration

Listing 14.1. A Gogs notification extractor implementation

Chapter 16. Working with Spring Boot Actuator

Listing 16.1. The results from the /env endpoint

Listing 16.2. HTTP mappings as shown by the /mappings endpoint

Listing 16.3. A custom implementation of InfoContributor

Listing 16.4. Full Git commit info exposed through the /info endpoint

Listing 16.5. An unusual implementation of HealthIndicator

Listing 16.6. TacoMetrics registers metrics around taco ingredients

Listing 16.7. A custom endpoint for taking notes

Chapter 18. Monitoring Spring with JMX

Listing 18.1. An MBean that counts how many tacos have been created

Listing 18.2. Sending notifications for every 100 tacos

Chapter 19. Deploying Spring

Listing 19.1. Enabling Spring web applications via Java

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset