在index.html添加
<p style="color: red" th:text="${msg}" th:if="${not #strings.isEmpty(msg)}"></p>
之后错误登录无法加载css等样式
解决
将css、js等文件的路径改为绝对路径
<link th:href="@{css/bootstrap.min.css}" rel="stylesheet">
<!-- Custom styles for this template -->
<link th:href="@{css/signin.css}" rel="stylesheet">
<img class="mb-4" th:src="@{img/bootstrap-solid.svg}" alt="" width="72" height="72">