Annotation, Multi-valued annotation, nested annotation, 多值注解, 嵌套注解
今天在研究Spring MVC的Validation机制时(这里 | 还有这里),简单看了下一些注解的源码,比如@Min,发现以前从来没注意到的注解写法。看来基础知识有疏漏啊...
/** * Validate a zipcode for a given country * The only supported type is String */ @Documented @Constraint(validatedBy = ZipCodeValidator.class) @Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER }) @Retention(RUNTIME) public @interface ZipCode { String countryCode(); String message() default "{com.acme.constraint.ZipCode.message}"; Class[] groups() default {}; Class