请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

消息模块后端启动报错,是少了什么注解嘛

https://img1.sycdn.imooc.com//szimg/622eb7c0096e264817890648.jpg

Field mongoTemplate in com.example.emos.wx.db.dao.MessageDao required a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' that could not be found.

WARN   Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageTask': Unsatisfied dependency expressed through field 'messageService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageServiceImpl': Unsatisfied dependency expressed through field 'messageDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'messageDao': Unsatisfied dependency expressed through field 'mongoTemplate'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.data.mongodb.core.MongoTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}


正在回答 回答被采纳积分+3

1回答

神思者 2022-03-14 14:13:21

你的mongodb配置的不对,检查yml文件和dao的注解

0 回复 有任何疑惑可以回复我~
  • 提问者 Roem #1
    解决了 谢谢老师,是启动类加了exclude = MongoAutoConfiguration.class导致启动失败
    回复 有任何疑惑可以回复我~ 2022-03-14 19:29:30
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信