<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Users</title>
</head>
<body>
<div th:switch="${users}">
    <h2 th:case="null">No users found!</h2>
    <div th:case="*">
        <h2>Users</h2>
        <table>
            <thead>
            <tr>
                <th>Id</th>
                <th>First name</th>
                <th>Last name</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="user : ${users}">
                <td th:text="${user.id}"></td>
                <td th:text="${user.firstName}"></td>
                <td th:text="${user.lastName}"></td>
                <td><a th:href="@{ListUpdateUser/{id}(id=${user.id})}">Edit</a></td>
                <td><a th:href="@{user-delete/{id}(id=${user.id})}">Delete</a></td>
            </tr>
            </tbody>
        </table>
    </div>
    <p><a href="/ListUserCreate">Create user</a></p>
</div>
</body>
</html>    <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="UTF-8">
<title>Create user</title>
<body>
<form action="#" th:action="@{/ListUpdateUser}" th:object="${user}" method="post">
    <label for="id">ID</label>
    <input readonly type="number" th:field="*{id}" id="id" placeholder="ID">
    <br/>
    <label for="firstName">First name</label>
    <input type="text" th:field="*{firstName}" id="firstName" placeholder="First Name">
    <br/>
    <label for="lastName">Last name</label>
    <input type="text" th:field="*{lastName}" id="lastName" placeholder="Last Name">
    <br/>
    <input type="submit" value="Update User">
</form>
</body>
</html>   <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Create user</title>
</head>
<body>
<form action="#" th:action="@{/ListCreateUser}" th:object="${user}" method="post">
    <label for="firstName">First name</label>
    <input type="text" th:field="*{firstName}" id="firstName" placeholder="First Name">
    <label for="lastName">Last name</label>
    <input type="text" th:field="*{lastName}" id="lastName" placeholder="Last Name">
    <input type="submit" value="Create User">
</form>
</body>
</html>       
@Controller
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @GetMapping("/users")
    public String findAll(Model model){
        List<User> users = userService.findAll();
        model.addAttribute("users", users);
        return "ListUser";
    }

    @GetMapping("/ListCreateUser")
    public String createUserForm(User user){

        return "ListCreateUser";
    }

    @PostMapping("/ListCreateUser")
    public String createUser(User user){
        userService.saveUser(user);
        return "redirect:/users";
    }

    @GetMapping("user-delete/{id}")
    public String deleteUser(@PathVariable("id") Long id){
        userService.deleteById(id);
        return "redirect:/users";
    }

    @GetMapping("/ListUpdateUser/{id}")
    public String updateUserForm(@PathVariable("id") Long id, Model model){
        User user = userService.findById(id);
        model.addAttribute("user", user);
        return "ListUpdateUser";
    }

    @PostMapping("/ListUpdateUser")
    public String updateUser(User user){
        userService.saveUser(user);
        return "redirect:/users";
    }

}
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sat Jun 24 18:46:36 MSK 2023
There was an unexpected error (type=Not Found, status=404).