1. 本章内容

  1. 在这一章我们会对框架的IOC以及AOP的功能进行测试

2. 编写相关的测试类

2.1 编写我们需要被增强的类:AspectTarget

2.1.1 需要完成的代码如下
package com.wuyiccc.demo.aop;

import com.wuyiccc.helloframework.core.annotation.Component;
import lombok.extern.slf4j.Slf4j;

/** * @author wuyiccc * @date 2020/7/14 15:39 * 岂曰无衣,与子同袍~ */
@Component
@Slf4j
public class AspectTarget {

    public void testRight() {
        log.info("AspectTarget#Right()方法执行!");
    }


    public void testThrowing() {
        log.info("AspectTarget#testThrowing()方法执行");
        throw new RuntimeException();
    }

}

2.1.2 AspectTarget图示:

2.2 编写切面类:

2.2.1 代码图示如下:

2.3 编写需要被依赖注入的类: IocTest

3. 开始测试

github地址:https://github.com/wuyiccc/helloframework

本文地址:https://blog.csdn.net/qq_27148729/article/details/107340577