标签:icp 事务 用户 print test code void out --
静态代理没啥好说的,直接上代码
package com.yk.aop.staticproxy; import org.junit.jupiter.api.Test; //1.接口 public interface IUserDao { void save(); void find(); } //2.实现类 class UserDao implements IUserDao { public void save() { System.out.println("保存用户"); } public void find() { System.out.println("查询用户"); } @Test public void test(){ System.out.print(111); } } /** * 3.静态代理 */ class UserDaoProxy implements IUserDao { private IUserDao target; public UserDaoProxy(IUserDao target) { this.target = target; } public void save() { System.out.println("开启事物"); target.save(); System.out.println("提交事务"); } public void find() { System.out.println("查找前操作"); target.find(); System.out.println("查找后操作"); } }
标签:icp 事务 用户 print test code void out --
原文地址:https://www.cnblogs.com/shenjichenai/p/10415930.html