java ssm框架的问题

WARN support.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:

Error creating bean with name 'loginServiceImpl': Unsatisfied dependency expressed through field 'adminDao': No qualifying bean of type [com.dabay.service.web.manager.Dao.AdminDao] found for dependency [com.dabay.service.web.manager.Dao.AdminDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dabay.service.web.manager.Dao.AdminDao] found for dependency [com.dabay.service.web.manager.Dao.AdminDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'loginServiceImpl': Unsatisfied dependency expressed through field 'adminDao': No qualifying bean of type [com.dabay.service.web.manager.Dao.AdminDao] found for dependency [com.dabay.service.web.manager.Dao.AdminDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.dabay.service.web.manager.Dao.AdminDao] found for dependency [com.dabay.service.web.manager.Dao.AdminDao]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

2个回答

1.这个adminDao如果没配置的话,需要进行配置,id不要重复了
2.adminDao如果已经配置,建议使用@Qualifier("adminDao")进行标注说明你到底要使用哪个dao
3.建议对dao层进行自动注入配置


希望对你有所帮助,不对的地方请见谅

回答了也没有赏金,就知道忽悠人,不告诉你们了,小气

wq8660389
wq8660389 回复sinat_35134348:算了,你叫我好友吧,我不会都问你 我在公司实习 好难啊
3 年多之前 回复
sinat_35134348
传说中的神话灬 呵呵啦,楼上讲的这么详细都看不懂。。。
3 年多之前 回复
wq8660389
wq8660389 我看不懂,看懂了调试成功了自然给赏金
3 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问