I have the following Spring Boot @Configuration
class:
@Configuration
@EnableReactiveMongoRepositories
class MongoConfiguration : AbstractReactiveMongoConfiguration()
{
override fun reactiveMongoClient() = MongoClients.create()
override fun getDatabaseName() = "mydb"
override fun customConversions(): MongoCustomConversions =
MongoCustomConversions(listOf(ZonedDateTimeReadConverter(), ZonedDateTimeWriteConverter()))
}
The application fails to start, and logs this message:
The bean 'reactiveMongoTemplate', defined in class path resource [org/springframework/boot/autoconfigure/data/mongo/MongoReactiveDataAutoConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [com/mypackage/MongoConfiguration.class] and overriding is disabled.
This puzzles me, as the reactiveMongoTemplate
ben method in MongoReactiveDataAutoConfiguration
is configured with @ConditionalOnMissingBean
.