Showing the Cart
Explore how to show the shopping cart on a web page within a Spring Boot application. Learn to inject reactive repositories, use WebFlux with Thymeleaf templates, and display inventory and cart items dynamically. Understand form handling and configuration to support DELETE operations in a reactive environment.
We'll cover the following...
We'll cover the following...
Showing the cart on the web page
Before we start manipulating the cart, it would be useful to show it on the web page.
For this, we need to retool ourHomeController.
To do that, we first need to inject our new repositories:
HomeController getting repositories via constructor injection
Here’s the breakdown of the code written above:
-
In line 1,
@Controllersignals this as a Spring Web controller that serves up templated views. -
In line 6, the constructor is used by Spring to inject the ...