You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
// 声明该代码文件所在的包名
package com.annotation ;
// 导入 java.lang.annotation.ElementType 类,该类用于指定注解可以应用的目标元素类型,
// 例如类、方法、字段等,在定义注解时需要使用它来指定注解的作用目标
import java.lang.annotation.ElementType ;
// 导入 java.lang.annotation.Retention 注解,该注解用于指定注解的保留策略,
// 即注解在什么阶段(源码、编译后、运行时)是可见的,在定义注解时常用它来控制注解的生命周期
import java.lang.annotation.Retention ;
// 导入 java.lang.annotation.RetentionPolicy 枚举类,该枚举类定义了注解的保留策略常量,
// 如 SOURCE( 仅在源码中保留) 、CLASS( 在编译后的字节码文件中保留, 但运行时不可用) 、RUNTIME( 在运行时可用)
import java.lang.annotation.RetentionPolicy ;
// 导入 java.lang.annotation.Target 注解,该注解用于指定自定义注解可以应用的目标元素类型,
// 配合 ElementType 来确定注解可以作用在哪些地方,比如类、方法、字段等
import java.lang.annotation.Target ;
// 登录的用户信息
// 自定义注解,标识需要注入当前登录用户信息的方法参数
@Target ( ElementType . PARAMETER )
// 指定该注解只能用于方法参数上
@Retention ( RetentionPolicy . RUNTIME )
// 指定该注解在运行时保留,可以通过反射读取
public @interface APPLoginUser {
// 定义一个空注解,作为标记使用
// 实际使用时可以配合拦截器或参数解析器,自动注入当前登录用户对象
}