Dropwizard @Validated annotation vs @Valid

1,129 views
Skip to first unread message

Keith Tsui

unread,
Jan 5, 2015, 11:29:18 AM1/5/15
to dropwiz...@googlegroups.com
Is there a functional difference between the two in DW 0.6.2?  Docs all say to use @Valid but @Validated works fine as well.  Thanks!

-Keith

Jochen Schalanda

unread,
Jan 5, 2015, 1:12:16 PM1/5/15
to dropwiz...@googlegroups.com
Hi Keith,

the @Validated annotation of Dropwizard isn’t exactly identical to the standard @Valid annotation (see https://dropwizard.github.io/dropwizard/0.6.2/maven/dropwizard-core/apidocs/com/yammer/dropwizard/validation/Validated.html for details) but in normal cases (e. g. when you don’t want to use multiple validation groups) the can be interchanged.


Cheers,
Jochen


Am 05.01.2015 um 17:29 schrieb Keith Tsui <keith...@gmail.com>:

Is there a functional difference between the two in DW 0.6.2?  Docs all say to use @Valid but @Validated works fine as well.  Thanks!

-Keith

--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Justin Theiss

unread,
Apr 1, 2015, 6:31:12 AM4/1/15
to dropwiz...@googlegroups.com
Hey Keith, I've been reading about this topic and stumbled upon your post and this one, which clarfies the difference:

http://stackoverflow.com/questions/18911154/how-to-specify-validation-group-for-valid

as Jochen notes, @Validated is not standard JAVA EE, but comes from Spring 3.1.
However it's more important here to note where the original "@Validate" annotation will NOT work, and that's with Validation Groups
Reply all
Reply to author
Forward
0 new messages