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

来源:9-12 执行系统消息异步收发(一)

Roem

2022-03-14

http://img.mukewang.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)}


写回答

1回答

神思者

2022-03-14

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

0
1
Roem
解决了 谢谢老师,是启动类加了exclude = MongoAutoConfiguration.class导致启动失败
2022-03-14
共1条回复

SpringBoot 在线协同办公小程序开发 全栈式项目实战

未来趋势型业务 + 前后端综合技术栈 + 惊艳的细节打磨

1798 学习 · 1915 问题

查看课程