【发布时间】:2017-09-19 06:33:02
【问题描述】:
我有一个自定义注释@MyAnnotation
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface MyAnnotation {
String [] roles() default {};
}
我正在使用我的注释作为
@MyAnnotation
@RequestMapping(value = "/test/xyz", method = RequestMethod.POST)
@ResponseBody
public String myFunc(@Valid TestClass test) {
return "Name: " + test.getName();
}
我想在 Javax 的 @Valid 注释之前执行我的自定义注释 @MyAnnotation,因为我正在我的注释实现中执行一些安全检查,并且需要在验证正文之前执行这些检查。
有没有一种方法可以提高自定义注释的优先级,使其在@Valid 注释之前执行?
【问题讨论】:
标签: spring aop spring-annotations