各位大牛,我项目是struts2+spring4.2.8+hibernate,原来是jdk1.7,tomcat7.0.67,正常启动没有问题,现在由于部分原因要进行升级到jsk1.8,tomcat8,但是启动时候就报错,项目其他的类似appDaoImpl都是继承于baseDaoImpl
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.sdjz.eshop.dao.BaseDao] is defined: expected single matching bean but found 109: appDaoImpl,baseDaoImpl......
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1133)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1021)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:508)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:486)
其中/**
* Dao实现类 - Dao实现类基类
*
*/
@Repository
public class BaseDaoImpl<T, PK extends Serializable> implements BaseDao<T, PK> {
private Class<T> entityClass;
protected SessionFactory sessionFactory;
。。。
}
@Repository
public class AppDaoImpl extends BaseDaoImpl<App, String> implements AppDao {
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
你有的地方注解了com.sdjz.eshop.dao.BaseDao 但是这个是个抽象类,实现类有好多个,你没有指定到底注解哪个。
不知道你这个@Resource是spring的还是java规范里的。如果是spring的,可以在加个名字@Qualifier("implName")里面填实现类的名字
是java的 @Resource,但是为什么原来在jdk1.7+tomcat7下运行没有问题呢这是因为,你1个接口,有2个实现类
spring自动注入发生了歧义
要么删除一个,要么使用限定符,告诉spring注入一个
这是因为,你1个接口,有2个实现类
spring自动注入发生了歧义
要么删除一个,要么使用限定符,告诉spring注入一个
把BaseDaoImpl类上的@ Repository 去掉