创建类而不是实例,使用spring cgLib动态创建类
while (true)
{
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(Test.class);
enhancer.setUseCache(false);
enhancer.setCallback(new MethodInterceptor()
{
@Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy)
throws Throwable
{
return methodProxy.invokeSuper(o,objects);
}
});
enhancer.create();
}
posted on 2017-11-06 10:51  轮回之牟  阅读(159)  评论(0编辑  收藏  举报