RequireLogin.java
547 Bytes
package com.glsx.usedcar.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 自定义注解:标记需要登录认证的接口
*/
@Target({ElementType.METHOD, ElementType.TYPE}) // 可标记在方法/类上
@Retention(RetentionPolicy.RUNTIME) // 运行时生效
public @interface RequireLogin {
// 可扩展属性,比如是否忽略认证(默认false)
boolean required() default true;
}