关于cglib.jar这个包,今天我没有导入居然不报错.

xszhang911 2015-09-12 01:27:20
是这样的,今天写的项目有个实现类,继承DAO接口.然后运行下,出现报错,
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'showArticleTreeAction': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'articleService' must be of type [org.zrg.service.ArticleService], but was actually of type [com.sun.proxy.$Proxy15]

然后我将Spring的配置改成:<aop:config proxy-target-class="true">
即将默认的false改成了true,此时我并未添加cglib.jar这个包,再次运行junit测试,居然通过了.
本人用的是Spring4+Struts2+HIberianate4,请问各位达人,到底是现在不需要这个包了,还是我这些框架里面自带了.
对了,我额外的零散的包还有几个:aspectjrt.jar 以及 aspectjrtweaver.jar 和aopalliance-1.0.jar 跟 commons-dbcp-1.4.jar
还有commons-pool-1.5.3.jar 这几个.
请问该如何解释,
...全文
435 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xszhang911 2015-09-12
  • 打赏
  • 举报
回复
还有1点,就是我在model层的Article类上(对应的表是article),设置了@Table(name="article")之后,再运行,也会报错.去掉@table就又可以了.错误信息如下: 01:54:12,485 WARN ClassPathXmlApplicationContext:487 - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlDaoImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateTemplate' defined in class path resource [beans.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.Table.indexes()[Ljavax/persistence/Index; 对了,我用的是Spring的xml文件,名字叫beans.xml放在src目录下,不是用Spring默认的applicationContext.xml,路径我设置过,以前也没出过错,

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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