可以被继承 首先注解在类上是可以被继承的 在注解上用@Inherited /** * Created by laizhenwei on 17:49 2017-10-14 */ @Target({ElementType.TYPE,ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Inherited public @interface Mark { String desc() default ""; } 注解在方法上(jdk
利用AOP技术注解的方式对功能进行增强 CustomerDao接口 package com.alphajuns.demo1; public interface CustomerDao { public void save(); public void update(); } CustomerDaoImpl实现类 package com.alphajuns.demo1; public class CustomerDaoImpl implements CustomerDao { @Override