创建自定义注解
@Target(ElementType.METHOD)
@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface MyAnnotaion {
String value() default "";
}
## 注解增强
```java
@Component
@Aspect
public class MyAnnotationAspect {
@Before("@annotation(com.yu.aop.service.MyAnnotaion) && @annotation(myAnnotaion)")
public void before(MyAnnotaion myAnnotaion){
System.out.println("注解增强前置方法"+myAnnotaion.value());
}
}
##测试
```java
@MyAnnotaion(value = "自定义注解")
public void delete() {
System.out.println("delete 方法");
}