Spring高手帮忙看下代码

james513215275 2009-08-28 03:23:49


import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import org.springframework.aop.MethodBeforeAdvice;


public class AopProxyFactory {
public static Object createProxy(final Object target,final MethodBeforeAdvice methodBeforeAdive){
return Proxy.new ProxyEnstance(
target.getClass().getClassLoader(),
target.getClass().getInterfaces(),
new InvocationHandler(){
public Object invoke(Object proxy,Method method,Object[] args)throws Throwable{
methodBeforeAdive.before(method, args, target);
return method.invoke(target, args);
}
});
}
}

上面这段代码中eclipse提示Proxy这个错误是怎么回事?
...全文
99 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihao1129 2009-08-28
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 james513215275 的回复:]
引用 6 楼 kiss_the_java 的回复:
楼主这写的不是代码,是寂寞

什么寂寞?撒意思?没看明白~
[/Quote]

呵呵 这可是 魔兽世界上的 流行语哟
ImAHunter 2009-08-28
  • 打赏
  • 举报
回复
haha,这样都没有红线提示你?
雪融寒 2009-08-28
  • 打赏
  • 举报
回复
是寂寞
sunnyfun888 2009-08-28
  • 打赏
  • 举报
回复
在CV大法流行的时代,楼主还能手敲书上的代码,还真耐得住寂寞...
luffyke 2009-08-28
  • 打赏
  • 举报
回复
呵呵!小错误,粗心了
james513215275 2009-08-28
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 kiss_the_java 的回复:]
楼主这写的不是代码,是寂寞
[/Quote]
什么寂寞?撒意思?没看明白~
kiss_the_java 2009-08-28
  • 打赏
  • 举报
回复
楼主这写的不是代码,是寂寞
james513215275 2009-08-28
  • 打赏
  • 举报
回复
哦,呵呵,知道了,按书上敲的,可能写new 习惯了,半天没检查出来什么问题,精神萎靡,几天没睡好了
windforcecn 2009-08-28
  • 打赏
  • 举报
回复
public class AopProxyFactory {
public static Object createProxy(final Object target, final MethodBeforeAdvice methodBeforeAdive) {
return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
methodBeforeAdive.before(method, args, target);
return method.invoke(target, args);
}
});

}
}


是newProxyInstance不是new ProxyInstance
  • 打赏
  • 举报
回复
Proxy.new ProxyEnstance,楼主真是高人阿!!!Proxy.newProxyInstance,请仔细看看这两者区别吧
james513215275 2009-08-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 musecangying007 的回复:]
return Proxy.new ProxyEnstance(
是I 不是E

[/Quote]
改了啊,还是不对
musecangying007 2009-08-28
  • 打赏
  • 举报
回复
return Proxy.new ProxyEnstance(
是I 不是E

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧