问题描述
|
我正在尝试使用某种休眠对象解包器/急切的访存器,而beanlib似乎正是我所需要的。但是,当我尝试在grails
1.3.7
项目中使用它时,只会出现以下错误:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name \'userService\': Invocation of init method Failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
我的用法很简单:
Hibernate3Dtocopier replicator = new Hibernate3Dtocopier()
return replicator.deepcopy(user)
我已经尝试排除传递依赖,但是无论我尝试什么,这都会以各种方式失败。帮帮我?
解决方法
推土机会执行此操作,但前提是您忽略文档。
private Mapper mapper = new DozerBeanMapper();
User findUser(String userId) {
def user = User.findByUserId(userId)
return mapper.map(user,User.class)
}
“ 4”将尝试从类路径中加载XML文件,而手动实例化则不会。
,Beanlib的默认行为要求要复制的Java Bean具有默认的无参数构造函数。错误消息似乎表明\ useruser \中缺少此类ctor。
有关更多信息,请参见FAQ(1):
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-doc/faq.html