I want to create a meta-annotation, called @QueryRequest
, for Spring's @RequestBody
like shown in below.
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
@RequestBody
public @interface QueryRequest {
}
However, it throws a compilation error called,
java: annotation type not applicable to this kind of declaration
When I searched in the internet, it tells me to verify the correct @Target
type. Anyway, as you can already see my @Target
and @Retention
values, they are as same as what Spring's @RequestBody
is, but still above error is thrown.
I have successfully created meta-annotations for @Target=ElementType.METHOD
or ElementType.TYPE
types, but I could not make work above annotation.
Anybody know what is actually wrong with above meta-annotation?