I'm trying to create an annotation to do some validations on path variables and I'm trying to combine @Pathvariable and my validations to a single annotation. this is to simplify coding and also to avoid the need for multiple decorations on path variables. is this possible to extend @PathVariable to create a custom annotation? thanks in advance for suggestions
Asked
Active
Viewed 26 times
0
-
did you try to add an AOP interceptor to do param validate? – PatrickChen May 10 '20 at 02:26
-
Here is a link for defining custom annotations - good luck: https://howtodoinjava.com/java/annotations/complete-java-annotations-tutorial/ – pczeus May 10 '20 at 02:30
-
@PatrickChen no, interceptor will not work in my particular scenario unfortunately, I need it as a custom pathvairiable annotation with some validations – KtPat01 May 10 '20 at 02:40
-
Examine (and perhaps subclass) `PathVariableMethodArgumentResolver`. – chrylis -cautiouslyoptimistic- May 10 '20 at 02:47