Using beanlib with grails (or another hibernate unwrapper), despite conflicting dependencies?
I'm trying to use some sort of hibernate object unwrapper/eager fetcher, and beanlib seems to do exactly what I need. However, when I try to use it within my grails 1.3.7
project, I only get the following errors:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean wit开发者_JAVA技巧h name 'userService': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassWriter.<init>(Z)V
My usage is trivial:
Hibernate3DtoCopier replicator = new Hibernate3DtoCopier()
return replicator.deepCopy(user)
I've tried excluding transitive dependencies, but no matter what I seem to try, this keeps failing in various ways. Help?
Dozer does this, but only if you ignore the documentation.
private Mapper mapper = new DozerBeanMapper();
User findUser(String userId) {
def user = User.findByUserId(userId)
return mapper.map(user, User.class)
}
The DozerBeanSingletonWrapper
will attempt to load XML files off the classpath, while manual instantiation will not.
The default behavior of Beanlib requires the java beans being replicated to have a default no-arg constructor. The error message seems to indicate the lack of such ctor in "userService".
For more info, see FAQ(1) at:
http://beanlib.svn.sourceforge.net/viewvc/beanlib/trunk/beanlib-doc/faq.html
精彩评论