项目中我把Service这层的类改了一下.定义了两个Service的父类.一个是:
- public interface GenericManager<T, PK extends Serializable> {
-
- public List<T> getAll();
-
- public T get(PK id);
-
- .......基本的CRUD方法
-
- }
- public class GenericManagerImpl<T, PK extends Serializable> implements GenericManager<T, PK> {
-
- protected BaseGenericHibernateDAO<T, PK> baseGenericHibernateDAO;
-
- public GenericManagerImpl(BaseGenericHibernateDAO<T, PK> baseGenericHibernateDAO) {
- this.baseGenericHibernateDAO = baseGenericHibernateDAO;
- }
-
- 对应实现上面的接口CRUD方法
-
- }
但是现在项目启动的时候抛出一个如下的错误:
Caused by: org.springframework.aop.framework.AopConfigException: Couldn't generate CGLIB subclass of class [class com.xxxx.user.service.impl.UserManagerImpl]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
Caused by: java.lang.IllegalArgumentException: Superclass has no null constructors but no arguments were given
at net.sf.cglib.proxy.Enhancer.emitConstructors(Enhancer.java:718)
是Spring AOP的问题.主要是出现在事务这块,由于我用的是Spring2.0 AOP 来声明事务.在声明事务的时候我把taget-prent-class="true" 了,但事实上不能为true.去掉这个就OK了因为要针对接口代理.
posted on 2007-12-23 20:26
周锐 阅读(917)
评论(0) 编辑 收藏 所属分类:
Apache 、
Spring