Thymeleaf表单提交Request method 'POST' not supported

最近在学习使用Thymeleaf,想使用表单向后台提交数据时,遇到了一些问题

###表单

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Title</title>
</head>
<body>
        <form th:action="@{/user/register}" method="post">
             <a>ID:<input type="text" name="userId"><br/></a>
           <a>昵称: <input type="text" name="nickname" ><br/></a>
            <a>密码:<input type="password" name="password" ></a>
            <input type="submit" value="提交">
        </form>

</body>
</html>

###Controller

@Controller
@RequestMapping("/user")
public class UserController {
    @PostMapping("/register")
    public String login(User user){
        System.out.println(user);
        return "/success.html";
    }
}

###错误

WARN 2384 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]

https://blog.csdn.net/weixin_42074868/article/details/85001093