Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在某些字段上有一个带有注释的模型,但在某些情况下,当我使用下面的命令时,我想通过此验证。
"validation.valid(object);".
我可以这样做吗?如何?
您必须@Required从类中删除注释并在其他地方验证字段,例如在您的控制器方法中,如下所示:
@Required
public class MyController extends Controller { public static void method( @Required value) { .... } }