Errata: October 14, 2020

Thank you for purchasing Spring in Action, Fifth Edition. Please post any errors, other than those listed below, in the book's Author Online Forum. We'll update this list as necessary. Thank you!

Page 31, listing 2.1:

The use of @RequiredArgsConstructor is not strictly necessary here, because @Data implies the generation of a required arguments constructor. (That said, using @RequiredArgsConstructor here does no harm.)

Page 33, listing 2.2:

The filterByType() method should be added to the tail end of listing 2.2, just before what is now the final closing curly-brace:

private List<Ingredient> filterByType(
    <Ingredient> ingredients, Type type) {
  return ingredients
            .filter(x -> x.getType().equals(type))

Page 35, para 2:

The phrase " copied into the servlet response attributes,..." should read:
" copied into the servlet request attributes,..."

Page 40, listing 2.4:

The Design type should be Taco.

public String processDesign(Taco design) {
  // Save the taco design...
  // We'll do this in chapter 3"Processing design: " + design);
  return "redirect:/orders/current";

The parameter name can also be changed, but what's more imiportant is that the type name be changed.

Page 41

The sentence following listing 2.5 should read: " automatically generate essential JavaBean methods for us at compile time so they will be available at runtime."

Page 57, listing 3.1:

The ninth line in listing 3.1 is currently:

"select id, name, type from Ingredient");

It should be:

"select id, name, type from Ingredient where id=?");

Page 88/89:

The code in Listing 4.2 will require a password encoder. Look at the example in section 4.2.2 for how you might set a password encoder. Or, optionally declare a bean method that returns an implementation of PasswordEncoder.

Page 18

Text mentions that Spring Boot’s default choice for connection pool is Tomcat JDBC, and this is incorrect. The correct text follows:

Spring Boot uses this connection data when autoconfiguring the `DataSource` bean. The `DataSource` bean will be pooled using the HikariCP connection pool if it’s available on the classpath. If not, Spring Boot looks for and uses one of these other connection pool implementations on the classpath:

  • Tomcat JDBC Connection Pool
  • Apache Commons DBCP2
  • Page 143, listing 6.2

    Add this note to listing 6.2:

    The findAll() method called on TacoRepository in Listing 6.2 accepts a PageRequest object to perform paging. This particular findAll() method is made available by changing TacoRepository so it extends PagingAndSortingRepository instead of CrudRepository. The downloadable sample code has this change in place, but it is never explicitly called out in the book's text.

    Page 201

    The first paragraph in the "Handling Rabbit MQ messages with listeners" should read:

    For message-driven RabbitMQ beans, Spring offers RabbitListener, the RabbitMQ counterpart to JmsListener. To specify that a method should be invoked when a message arrives in a RabbitMQ queue, annotate a bean’s method with @RabbitListener.