Search code examples
springspring-bootspring-dataspring-data-mongodb

How to configure MongoDB in Spring 2.5.0?


I used to have this @Configuration class that extends AbstractMongoConfiguration.

I want to upgrade to

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.0</version>
    <relativePath/>
</parent>

Once I'm doing that I see that this class cannot be resolved.

What's the alternative?

Note: I'd like to have multiple configurations for different profiles


Solution

  • AbstractMongoConfiguration was deprecated in Spring Data MongoDB 2.2 in favour of AbstractMongoClientConfiguration. It was then removed in Spring Data MongoDB 3.0. You should replace your usage of AbstractMongoConfiguration with AbstractMongoClientConfiguration.