springboot2.0以后的junit

只需要引入:

<dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

就可以可以单元测试:

/**
* 测试类
*/
public class App {

   @Test
   public void test(){
       //目标对象
       UserDao target = new UserDao();

       //代理对象
       UserDao proxy = (UserDao)new ProxyFactory(target).getProxyInstance();

       //执行代理对象的方法
       proxy.save();
   }
}

 

posted @ 2019-11-21 09:03  不死码农  阅读(717)  评论(0编辑  收藏  举报