Skip to content

Spring boot creates two mongo clients using spring-boot-starter-data-mongodb-reactive #12407

Closed
@cmario

Description

@cmario

Hi,

spring boot auto configures two MongoDB clients, one through MongoAutoConfiguration and one through MongoReactiveAutoConfiguration. If I try to exclude MongoAutoConfiguration I get the following error:

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

Description:

Parameter 0 of method mongoDbFactory in org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration required a bean of type 'com.mongodb.MongoClient' that could not be found.
	- Bean method 'mongo' not loaded because auto-configuration 'MongoAutoConfiguration' was excluded

Then, If I try to exclude MongoDataAutoConfiguration as well I get the following error:

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

Description:

Parameter 1 of method reactiveMongoTemplate in org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration required a bean of type 'org.springframework.data.mongodb.core.convert.MongoConverter' that could not be found.
	- Bean method 'mappingMongoConverter' not loaded because auto-configuration 'MongoDataAutoConfiguration' was excluded

Looks that is not possible to exclude the non reactive part.
Below you can find a simple example where "Cluster created with settings....etc" is logged two times:
https://github.com/cmario/spring-boot-embedded-mongodb

Regards
Mario

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions