package example.aop.proxy;

import com.sysu.admin.support.system.user.UserRepository;
import org.springframework.aop.framework.ProxyFactory;

public class Main {
    public static void main(String[] args) {


        ProxyFactory result = new ProxyFactory();
        result.setTarget(new MyRepositoryExecutor<>());

        result.setInterfaces(UserRepository.class);

        result.addAdvice(new MyMethodInterceptor());

        UserRepository repository = (UserRepository)result.getProxy(org.springframework.util.ClassUtils.getDefaultClassLoader());
        repository.findByUsername("123");
        repository.enable(0,0L);
    }
}
