Skip to content
Bluetape4k docs1.11

Auto-configuration and ownership boundaries

Latest stable Based on Bluetape4k release 1.11.0

The module’s AutoConfiguration.imports registers only ReactiveMongoAutoConfiguration. It creates ReactiveMongoTemplate when ReactiveMongoOperations is on the classpath and no bean of that type exists.

@AutoConfiguration
@ConditionalOnClass(ReactiveMongoOperations::class)
class ReactiveMongoAutoConfiguration {
@Bean
@ConditionalOnMissingBean(ReactiveMongoOperations::class)
fun reactiveMongoTemplate(
databaseFactory: ReactiveMongoDatabaseFactory,
mongoConverter: MongoConverter,
): ReactiveMongoTemplate =
ReactiveMongoTemplate(databaseFactory, mongoConverter)
}

It does not create the ReactiveMongoDatabaseFactory or MongoConverter. The fallback cannot be completed unless both beans are already available.

Spring Boot’s reactive MongoDB auto-configuration normally supplies ReactiveMongoOperations. The bluetape4k fallback then backs off because of @ConditionalOnMissingBean. It also backs off when the application registers its own ReactiveMongoTemplate.

Adding this artifact therefore does not create a second client or pool. Use the condition evaluation report to inspect the actual bean graph.

LayerOwned responsibilities
bluetape4k moduleCoroutine extensions, query DSL, template fallback
Spring Boot and Spring DataProperty binding, factory, mapping converter, template, lifecycle integration
ApplicationCustom conversions, auditing, index policy, transactions, domain repositories
MongoDB driverConnection pool, server selection, protocol, sessions, concerns, timeouts

The presence of MongoDB Kotlin driver dependencies in the build does not move driver configuration into bluetape4k auto-configuration.

The 1.11.0 source has no MongoCustomConversions bean and does not enable MongoDB auditing. Applications that need them should use a separate configuration.

@Configuration(proxyBeanMethods = false)
@EnableMongoAuditing
class MongoDomainConfiguration {
@Bean
fun mongoCustomConversions(): MongoCustomConversions =
MongoCustomConversions.create { adapter ->
adapter.registerConverter(MoneyWriteConverter())
}
}

A converter changes the stored wire format. Verify that old and new application versions can read the same documents before a rolling deployment.

Use the configured template in Coroutine reads and cardinality.