I solved my problem. Created a component with this method.
public void removeVerificationMessageFromSession() {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
HttpSession session = request.getSession();
session.removeAttribute("verificationMessage");
} catch (RuntimeException ex) {
log.error("No Request: ", ex);
}
}
and then I called this method in my code right after I consumed the message.
<div th:if="${session.message != null}">
// I consumed the message
<div th:text="${@sessionUtilityBean.removeVerificationMessageFromSession()}"></div>
</div>