Auto-configuration and ownership boundaries
Latest stable Based on Bluetape4k release 1.11.0
What the auto-configuration does
Section titled “What the auto-configuration does”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.
A typical Spring Boot application
Section titled “A typical Spring Boot application”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.
Responsibility map
Section titled “Responsibility map”| Layer | Owned responsibilities |
|---|---|
| bluetape4k module | Coroutine extensions, query DSL, template fallback |
| Spring Boot and Spring Data | Property binding, factory, mapping converter, template, lifecycle integration |
| Application | Custom conversions, auditing, index policy, transactions, domain repositories |
| MongoDB driver | Connection 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.
Custom conversion and auditing
Section titled “Custom conversion and auditing”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)@EnableMongoAuditingclass 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.
Source and tests
Section titled “Source and tests”Next chapter
Section titled “Next chapter”Use the configured template in Coroutine reads and cardinality.