Module structure
The starter is split into three modules:| Module | Artifact ID | Description |
|---|---|---|
| Library | atoti-what-if-lib | Core business logic, interfaces, and implementations |
| Configuration | atoti-what-if-config | Auto-configuration classes and property bindings |
| Starter | atoti-what-if-spring-boot-starter | Dependency aggregator that pulls in lib and config |
Auto-configuration classes
Each auto-configuration class is responsible for a specific functional area:| Class | Beans Created | Condition |
|---|---|---|
WhatIfCoreConfig | DatabaseSimulationEngine, IUniqueIdGenerator | Always active |
WhatIfPersistenceConfig | SessionFactory, ISimulationPersistenceManager | IWhatIfPersistenceProperties bean present |
WhatIfSecurityConfig | IDatabaseSimulationsSecurityManager | Based on security.type property |
WhatIfWorkflowConfig | IDatabaseSimulationsWorkflow | Always active |
WhatIfRestConfig | DatabaseSimulationsRestService, exception handler | Always active |
WhatIfDistributionConfig | RestDistributedDatabaseService, address/auth suppliers | distribution.enabled: true |
Bean creation order
Beans are created in dependency order: TheSessionFactory bean (named whatIfSessionFactory) can be overridden independently of ISimulationPersistenceManager. It includes destroyMethod = "close" to ensure proper resource cleanup on application shutdown.
Conditional annotations
The auto-configuration uses Spring Boot conditional annotations:@ConditionalOnMissingBean
All beans use@ConditionalOnMissingBean, allowing application-defined beans to take precedence:
@ConditionalOnProperty
Property-based conditions control feature activation:@ConditionalOnWhatIfEnabled
A custom conditional annotation that gates all What-If beans on theatoti.what-if.enable property. It combines two condition classes for different Spring lifecycle phases:
ConfigurationEnabledWhatIf— evaluates duringPARSE_CONFIGURATIONphase (applies to@Configurationclasses)BeanEnabledWhatIf— evaluates duringREGISTER_BEANphase (applies to@Beanmethods)
atoti.what-if.enable: false disables all auto-configuration classes annotated with @ConditionalOnWhatIfEnabled.
@ConditionalOnWhatIfDistributionEnabled
A custom conditional annotation that gates Atoti What-If distribution beans on theatoti.what-if.distribution.enabled property. Like @ConditionalOnWhatIfEnabled, it combines two condition classes for different Spring lifecycle phases:
ConfigurationEnabledWhatIfDistribution— evaluates duringPARSE_CONFIGURATIONphase (applies to@Configurationclasses)BeanEnabledWhatIfDistribution— evaluates duringREGISTER_BEANphase (applies to@Beanmethods)
@ConditionalOnWhatIfEnabled, this annotation does not default to enabled. When the property is absent, distribution beans are not registered.
The annotation is typically used alongside @ConditionalOnWhatIfEnabled on WhatIfDistributionConfig:
atoti.what-if.distribution.enabled: true activates distribution features. Defaults to false.
Property binding
Properties are bound using@ConfigurationProperties:
Extension points
Overriding beans
Define a bean of the same type to override auto-configuration:Required application beans
The starter requires these beans from your application:| Bean | Purpose |
|---|---|
IDatabaseService | Provided by Atoti Server for datastore operations |
IWhatIfPersistenceProperties | Provides Hibernate configuration for persistence |