|
|
@ -4,8 +4,16 @@ import java.lang.annotation.ElementType;
|
|
|
|
import java.lang.annotation.Retention;
|
|
|
|
import java.lang.annotation.Retention;
|
|
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
import java.lang.annotation.Target;
|
|
|
|
import java.lang.annotation.Target;
|
|
|
|
|
|
|
|
// 定义一个自定义注解名为 LoginUser
|
|
|
|
|
|
|
|
// 使用 @Target 注解指定该注解可以应用的目标元素类型为参数(ElementType.PARAMETER)
|
|
|
|
@Target(ElementType.PARAMETER)
|
|
|
|
@Target(ElementType.PARAMETER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 使用 @Retention 注解指定该注解在运行时是否可用
|
|
|
|
|
|
|
|
// RetentionPolicy.RUNTIME 表示该注解在运行时可以通过反射获取
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 定义一个空的自定义注解 LoginUser
|
|
|
|
public @interface LoginUser {
|
|
|
|
public @interface LoginUser {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|