Consider defining a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' in your configuration.报错原因

时间:2024-8-30    作者:老大夫    分类: 乐尚代驾


居然是pom文件依赖问题,明明已经引入了,重写一下就不报错了

换成

 <!--mongodb-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>

报错内容

“***************************
APPLICATION FAILED TO START
***************************

Description:

Field locationService in com.atguigu.daijia.map.controller.LocationController required a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'org.springframework.data.mongodb.core.MongoTemplate' in your configuration.


扫描二维码,在手机上阅读

推荐阅读: