我知道我可以为Play模型层中的@ Required注释执行自定义验证消息,如下所示:
@Required(message = "customError.required")
public String name;
但是我尝试对@MinSize注释执行相同的操作...
@MinSize(8)(message = "customError.passwordSoShort")
public String password;
...并收到此编译错误:
The file /app/models/User.java could not be compiled. Error raised is : Syntax error on token ")", ? expected
@MinSize(8)↓(message = "customError.passwordSoShort")
public String password;
最佳答案
您的代码存在语法错误。
尝试:
@MinSize(value=8, message = "customError.passwordSoShort")
public String password;