场景:
在自定义注解中,估计大家都知道三大必备元注解,分别为:@Target、@Retention、@Inherited,前两者不再赘述解释,主要是 @Inherited 可能还有人不太明白,一起看下
一、@Inherited 顾名思义,可被继承的注解
1、分别定义注解 ATable、BTable,如下:
package com.hkl.mpjoin.modules.testAnnotations.annotations;
import java.lang.annotation.*;
/**
* <p>Description:A注解标识</p>
* <p>Author:hkl</p>
* <p>Date:2022/12/2</p>
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface ATable {
String name() default "";
}
packa