Affects: Spring Framework 4.1.5
https://github.com/spring-projects/spring-framework/blob/20d9a1e84430830edca6cc58680ba74e40a96ca2/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AbstractMessageConverterMethodArgumentResolver.java#L240
AbstractMessageConverterMethodArgumentResolver#validateIfApplicable
I'm trying to custom an annotation whose name is "Valid", but this method makes my custom annotation can not work as I expected.
Comment From: beiranc
The annotaion which is name "Valid" was already definated, you can check for javax.validation.Valid. If you want to create a customize validate annotaion, you can Google "How to customize parameter validate annotaion in spring".
Comment From: lanicc
In my opinion, "valid" is just a name. I can use this annotation to validate parameters and do other things. Spring should not use a name to determine its logic. Is there anything special about this name in some rules?
Comment From: sbrannen
Spring should not use a name to determine its logic. Is there anything special about this name in some rules?
Yes, this convention has been in place for a long time. See https://github.com/spring-projects/spring-framework/issues/17256#issuecomment-453421696 for an explanation of why the convention will remain in place.
In light of the above, I am repurposing this issue to improve the documentation in the reference manual which currently only highlights support for @javax.validation.Valid
or Spring's @Validated
annotations for triggering validation.
Comment From: lanicc
Yes, this convention has been in place for a long time. See #17256 (comment) for an explanation of why the convention will remain in place.
Will you consider removing this later?
Comment From: lanicc
Thanks for yoyr answer